We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
comptime_int
u64
Trying to compile the following code
comptime { var a : u8 = @truncate(u1, 1 << 64); }
results in (the value 139978047751248 changes every time)
139978047751248
./main.zig:2:18: error: integer value 139978047751248 cannot be coerced to type 'u8' var a : u8 = @truncate(u1, 1 << 64); ^
This seems to be reason behind the following problems :
unreachable
test "large comptime_int truncation" { if (@truncate(u1, 0x1_0000_0000_0000_0000) != 0) unreachable; }
0
const print = @import("std").debug.print; test "print large comptime_int truncation" { print("{}", .{@truncate(u1, 0x1_0000_0000_0000_0001)}); }
The text was updated successfully, but these errors were encountered:
Fix ziglang#9299
171a752
cff7ece
Fix unexpected truncation behavior with comptime_int larger than u64 …
ceebcfa
…range (#9303) Closes #9299
No branches or pull requests
Trying to compile the following code
results in (the value
139978047751248
changes every time)This seems to be reason behind the following problems :
unreachable
.0
.The text was updated successfully, but these errors were encountered: