Keep -vet happy

This commit is contained in:
gingerBill
2023-07-31 12:19:25 +01:00
parent f17077c05c
commit 5dba08fb3b
3 changed files with 27 additions and 30 deletions

View File

@@ -2286,20 +2286,20 @@ F64_MASK :: 0x7ff
F64_SHIFT :: 64 - 12
F64_BIAS :: 0x3ff
INF_F16 :f16: 0h7C00
NEG_INF_F16 :f16: 0hFC00
INF_F16 :: f16(0h7C00)
NEG_INF_F16 :: f16(0hFC00)
SNAN_F16 :f16: 0h7C01
QNAN_F16 :f16: 0h7E01
SNAN_F16 :: f16(0h7C01)
QNAN_F16 :: f16(0h7E01)
INF_F32 :f32: 0h7F80_0000
NEG_INF_F32 :f32: 0hFF80_0000
INF_F32 :: f32(0h7F80_0000)
NEG_INF_F32 :: f32(0hFF80_0000)
SNAN_F32 :f32: 0hFF80_0001
QNAN_F32 :f32: 0hFFC0_0001
SNAN_F32 :: f32(0hFF80_0001)
QNAN_F32 :: f32(0hFFC0_0001)
INF_F64 :f64: 0h7FF0_0000_0000_0000
NEG_INF_F64 :f64: 0hFFF0_0000_0000_0000
INF_F64 :: f64(0h7FF0_0000_0000_0000)
NEG_INF_F64 :: f64(0hFFF0_0000_0000_0000)
SNAN_F64 :f64: 0h7FF0_0000_0000_0001
QNAN_F64 :f64: 0h7FF8_0000_0000_0001
SNAN_F64 :: f64(0h7FF0_0000_0000_0001)
QNAN_F64 :: f64(0h7FF8_0000_0000_0001)

View File

@@ -131,38 +131,35 @@ test_read :: proc(t: ^testing.T) {
@test
test_write :: proc(t: ^testing.T) {
using hxa
n1 :Node
n1: hxa.Node
n1_m1_value := []f64le{0.4, -1.23, 2341.6, -333.333}
n1_m1 := Meta{"m1", n1_m1_value}
n1_m1 := hxa.Meta{"m1", n1_m1_value}
n1.meta_data = []Meta{n1_m1}
n1.meta_data = []hxa.Meta{n1_m1}
n1_l1 := Layer{"l1", 2, []f32le{32.1, -41.3}}
n1_l2 := Layer{"l2", 3, []f64le{0.64, 1.64, -2.64}}
n1_l1 := hxa.Layer{"l1", 2, []f32le{32.1, -41.3}}
n1_l2 := hxa.Layer{"l2", 3, []f64le{0.64, 1.64, -2.64}}
n1_content := Node_Image{Image_Type.Image_1D, [3]u32le{1, 1, 2}, Layer_Stack{n1_l1, n1_l2}}
n1_content := hxa.Node_Image{.Image_1D, [3]u32le{1, 1, 2}, hxa.Layer_Stack{n1_l1, n1_l2}}
n1.content = n1_content
w_file :File
w_file.nodes = []Node{n1}
w_file: hxa.File
w_file.nodes = []hxa.Node{n1}
required_size := required_write_size(w_file)
required_size := hxa.required_write_size(w_file)
buf := make([]u8, required_size)
n, write_err := write(buf, w_file)
n, write_err := hxa.write(buf, w_file)
write_e :: hxa.Write_Error.None
tc.expect(t, write_err == write_e, fmt.tprintf("%v: write_err %v != %v", #procedure, write_err, write_e))
tc.expect(t, n == required_size, fmt.tprintf("%v: n %v != %v", #procedure, n, required_size))
file, read_err := read(buf)
file, read_err := hxa.read(buf)
read_e :: hxa.Read_Error.None
tc.expect(t, read_err == read_e, fmt.tprintf("%v: read_err %v != %v", #procedure, read_err, read_e))
defer file_destroy(file)
defer hxa.file_destroy(file)
delete(buf)

View File

@@ -73,10 +73,10 @@ test_classify_f16 :: proc(t: ^testing.T) {
}
/* Check all subnormals (exponent 0, 10-bit significand non-zero) */
for i :u16 = 1; i < 0x400; i += 1 {
v :f16 = transmute(f16)i
for i in u16(1)..<0x400 {
v := transmute(f16)i
r = classify_f16(v)
e :Float_Class: Subnormal
e :: Float_Class.Subnormal
tc.expect(t, r == e, fmt.tprintf("i:%d %s(%h) -> %v != %v", i, #procedure, v, r, e))
}
}