blob: 4202dc2939203483d702f354a50505fb18ff1e50 [file]
// Copyright 2026 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.
//go:build goexperiment.simd
package simd_test
import (
"simd"
"simd/testdata"
"testing"
"unsafe"
)
var v simd.Float32s
func TestSizeof(t *testing.T) {
var f float32
sv0 := int(unsafe.Sizeof(v))
sv1 := v.Len() * int(unsafe.Sizeof(f))
sV := int(unsafe.Sizeof(testdata.V))
sF := int(unsafe.Sizeof(testdata.F()))
if sv0 != sv1 {
t.Errorf("sv0=%d and sv1=%d should be equal but are not", sv0, sv1)
}
if sF != sv1 {
t.Errorf("sF=%d and sv1=%d should be equal but are not", sF, sv1)
}
if sV != sv1 {
t.Errorf("sV=%d and sv1=%d should be equal but are not", sV, sv1)
}
}