compiler: implement clear builtin for slices

This commit is contained in:
Ayke van Laethem
2023-07-07 15:15:49 +02:00
committed by Ron Evans
parent f791c821ff
commit a2f886a67a
6 changed files with 95 additions and 21 deletions
+8
View File
@@ -51,3 +51,11 @@ func maxFloat32(a, b float32) float32 {
func maxString(a, b string) string {
return max(a, b)
}
func clearSlice(s []int) {
clear(s)
}
func clearZeroSizedSlice(s []struct{}) {
clear(s)
}