On 12/24/22 00:15, Song Gao wrote:
+#define S_EVEN(a, bit) \
+ ((((int64_t)(a)) << (64 - bit / 2)) >> (64 - bit / 2))
+
+#define U_EVEN(a, bit) \
+ ((((uint64_t)(a)) << (64 - bit / 2)) >> (64 - bit / 2))
+
+#define S_ODD(a, bit) \
+ ((((int64_t)(a)) << (64 - bit)) >> (64 - bit/ 2))
+
+#define U_ODD(a, bit) \
+ ((((uint64_t)(a)) << (64 - bit)) >> (64 - bit / 2))
+
+#define S_EVEN_Q(a, bit) \
+ ((((__int128)(a)) << (128 - bit / 2)) >> (128 - bit / 2))
+
+#define U_EVEN_Q(a, bit) \
+ ((((unsigned __int128)(a)) << (128 - bit / 2)) >> (128 - bit / 2))
+
+#define S_ODD_Q(a, bit) \
+ ((((__int128)(a)) << (128 - bit)) >> (128 - bit/ 2))
+
+#define U_ODD_Q(a, bit) \
+ ((((unsigned __int128)(a)) << (128 - bit)) >> (128 - bit / 2))
I suspect all of these are wrong. I believe bit is in [0-127], which means both (64 -
bit) and (128 - bit) generate out-of range shifts.
Also, you can't use __int128 directly.
I'm somewhat surprised that you're shifting at all, rather than indexing the correct
element from of the vec_t arrays.
r~