--- /dev/null
+// Copyright 2025 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// A hook to get correct floating point conversion from strconv
+// in packages that cannot import strconv.
+
+package ftoa
+
+var formatFloatPtr func(f float64, fmt byte, prec, bitSize int) string
+
+func FormatFloat(f float64, fmt byte, prec, bitSize int) string {
+ if formatFloatPtr != nil {
+ return formatFloatPtr(f, fmt, prec, bitSize)
+ }
+ return "internal/ftoa.formatFloatPtr called before strconv.init()"
+}
+
+func SetFormatFloat(ff func(f float64, fmt byte, prec, bitSize int) string) {
+ if formatFloatPtr == nil {
+ formatFloatPtr = ff
+ }
+}
foo(lh, 0, 3)
foo(hl, 2, 1)
}
+
+func TestString(t *testing.T) {
+ x := simd.LoadUint32x4Slice([]uint32{0, 1, 2, 3})
+ y := simd.LoadInt64x4Slice([]int64{-4, -5, -6, -7})
+ z := simd.LoadFloat32x4Slice([]float32{0.5, 1.5, -2.5, 3.5e9})
+ w := simd.LoadFloat64x4Slice([]float64{0.5, 1.5, -2.5, 3.5e9})
+
+ sx := "{0,1,2,3}"
+ sy := "{-4,-5,-6,-7}"
+ sz := "{0.5,1.5,-2.5,3.5e+09}"
+ sw := sz
+
+ if x.String() != sx {
+ t.Errorf("x=%s wanted %s", x, sx)
+ }
+ if y.String() != sy {
+ t.Errorf("y=%s wanted %s", y, sy)
+ }
+ if z.String() != sz {
+ t.Errorf("z=%s wanted %s", z, sz)
+ }
+ if w.String() != sw {
+ t.Errorf("w=%s wanted %s", w, sw)
+ }
+ t.Logf("w=%s", w)
+ t.Logf("x=%s", x)
+ t.Logf("y=%s", y)
+ t.Logf("z=%s", z)
+}
func (x Uint64x8) Not() Uint64x8 {
return x.Xor(x.Equal(x).AsInt64x8().AsUint64x8())
}
+
+// String returns a string representation of SIMD vector x
+func (x Int8x16) String() string {
+ var s [16]int8
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int16x8) String() string {
+ var s [8]int16
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int32x4) String() string {
+ var s [4]int32
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int64x2) String() string {
+ var s [2]int64
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint8x16) String() string {
+ var s [16]uint8
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint16x8) String() string {
+ var s [8]uint16
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint32x4) String() string {
+ var s [4]uint32
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint64x2) String() string {
+ var s [2]uint64
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Float32x4) String() string {
+ var s [4]float32
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Float64x2) String() string {
+ var s [2]float64
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int8x32) String() string {
+ var s [32]int8
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int16x16) String() string {
+ var s [16]int16
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int32x8) String() string {
+ var s [8]int32
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int64x4) String() string {
+ var s [4]int64
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint8x32) String() string {
+ var s [32]uint8
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint16x16) String() string {
+ var s [16]uint16
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint32x8) String() string {
+ var s [8]uint32
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint64x4) String() string {
+ var s [4]uint64
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Float32x8) String() string {
+ var s [8]float32
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Float64x4) String() string {
+ var s [4]float64
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int8x64) String() string {
+ var s [64]int8
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int16x32) String() string {
+ var s [32]int16
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int32x16) String() string {
+ var s [16]int32
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Int64x8) String() string {
+ var s [8]int64
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint8x64) String() string {
+ var s [64]uint8
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint16x32) String() string {
+ var s [32]uint16
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint32x16) String() string {
+ var s [16]uint32
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Uint64x8) String() string {
+ var s [8]uint64
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Float32x16) String() string {
+ var s [16]float32
+ x.Store(&s)
+ return sliceToString(s[:])
+}
+
+// String returns a string representation of SIMD vector x
+func (x Float64x8) String() string {
+ var s [8]float64
+ x.Store(&s)
+ return sliceToString(s[:])
+}