diff test/test_arith.h @ 10:d1d5d767004c

chore: merge diverging branches
author Paper <paper@tflc.us>
date Mon, 18 Nov 2024 15:44:09 -0500
parents 6ff0b7a44bb6 945d410803f8
children 53197dbf4e8e
line wrap: on
line diff
--- a/test/test_arith.h	Mon Nov 18 13:52:09 2024 -0500
+++ b/test/test_arith.h	Mon Nov 18 15:44:09 2024 -0500
@@ -40,7 +40,7 @@
 	\
 		for (int i = 0; i < size; i++) { \
 			if ((sign##int##bits##_t)(equiv) != orig_c[i]) { \
-				fprintf(stderr, "v" #sign "int" #bits "x" #size "_" #op " test FAILED at index %d: (" #equiv ") [%" PRI ## psign ## bits "] does not equal result [%" PRI ## psign ## bits "]!\n", i, equiv, orig_c[i]); \
+				fprintf(stderr, "v" #sign "int" #bits "x" #size "_" #op " test FAILED at index %d: (" #equiv ") [%" PRI ## psign ## bits "] does not equal result [%" PRI ## psign ## bits "]!\n", i, (sign##int##bits##_t)(equiv), orig_c[i]); \
 				print_v##sign##int##bits##x##size(stderr,a); \
 				print_vuint##bits##x##size(stderr,b); \
 				print_v##sign##int##bits##x##size(stderr,c); \
@@ -60,7 +60,7 @@
 	CREATE_TEST(sign, psign, csign, bits, size, and, orig_a[i] & orig_b[i]) \
 	CREATE_TEST(sign, psign, csign, bits, size, or,  orig_a[i] | orig_b[i]) \
 	CREATE_TEST(sign, psign, csign, bits, size, xor, orig_a[i] ^ orig_b[i]) \
-	CREATE_TEST(sign, psign, csign, bits, size, avg, (orig_a[i] * orig_b[i]) / 2) \
+	CREATE_TEST(sign, psign, csign, bits, size, avg, (sign##int##bits##_t)(orig_a[i] + orig_b[i]) / 2) \
 	CREATE_TEST_SHIFT(sign, psign, csign, bits, size, rshift, vec_##sign##rshift(orig_a[i], orig_b[i])) \
 	CREATE_TEST_SHIFT(sign, psign, csign, bits, size, lshift, vec_##sign##lshift(orig_a[i], orig_b[i])) \
 	CREATE_TEST_SHIFT(sign, psign, csign, bits, size, lrshift, vec_##sign##lrshift(orig_a[i], orig_b[i]))
@@ -104,6 +104,7 @@
 			ret |= test_arith_v##sign##int##bits##x##size##_and(a, b); \
 			ret |= test_arith_v##sign##int##bits##x##size##_or(a, b); \
 			ret |= test_arith_v##sign##int##bits##x##size##_xor(a, b); \
+			ret |= test_arith_v##sign##int##bits##x##size##_avg(a, b); \
 		} \
 	} \
 	\