mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
zig.h: fix shlo breakage on smaller bitwidths
This commit is contained in:
parent
c8541f0a12
commit
bd4a1f38fa
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user