amd64: removes embeddings of pointers of bit masks for FP arithmetic (#648)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
39
internal/u32/u32_test.go
Normal file
39
internal/u32/u32_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package u32
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"github.com/tetratelabs/wazero/internal/testing/require"
|
||||
)
|
||||
|
||||
func TestBytes(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input uint32
|
||||
}{
|
||||
{
|
||||
name: "zero",
|
||||
input: 0,
|
||||
},
|
||||
{
|
||||
name: "half",
|
||||
input: math.MaxInt32,
|
||||
},
|
||||
{
|
||||
name: "max",
|
||||
input: math.MaxUint32,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tc := tt
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
expected := make([]byte, 4)
|
||||
binary.LittleEndian.PutUint32(expected, tc.input)
|
||||
require.Equal(t, expected, LeBytes(tc.input))
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user