From bd4a1f38fa6895e85dcec0436a779af75df1872a Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Mon, 5 Dec 2022 05:05:59 -0500 Subject: [PATCH] zig.h: fix shlo breakage on smaller bitwidths --- lib/zig.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/zig.h b/lib/zig.h index 234ed707f7..a8fa948dc8 100644 --- a/lib/zig.h +++ b/lib/zig.h @@ -810,7 +810,7 @@ static inline void zig_vmulo_i16(zig_u8 *ov, zig_i16 *res, int n, \ static inline bool zig_shlo_u##w(zig_u##w *res, zig_u##w lhs, zig_u8 rhs, zig_u8 bits) { \ *res = zig_shlw_u##w(lhs, rhs, bits); \ - return lhs > zig_maxInt_u##w >> rhs; \ + return lhs > zig_maxInt(u##w, bits) >> rhs; \ } \ \ static inline bool zig_shlo_i##w(zig_i##w *res, zig_i##w lhs, zig_u8 rhs, zig_u8 bits) { \ @@ -1340,7 +1340,7 @@ static inline zig_i128 zig_mulw_i128(zig_i128 lhs, zig_i128 rhs, zig_u8 bits) { static inline bool zig_shlo_u128(zig_u128 *res, zig_u128 lhs, zig_u8 rhs, zig_u8 bits) { *res = zig_shlw_u128(lhs, rhs, bits); - return zig_cmp_u128(lhs, zig_shr_u128(zig_maxInt_u128, rhs)) > zig_as_i32(0); + return zig_cmp_u128(lhs, zig_shr_u128(zig_maxInt(u128, bits), rhs)) > zig_as_i32(0); } static inline bool zig_shlo_i128(zig_i128 *res, zig_i128 lhs, zig_u8 rhs, zig_u8 bits) {