Adding assert defeats optimisation
Ziggit
Adding assert defeats optimisation
Just a quick observation that I think might be a bug. If I have the following function: const assert = @import("std").debug.assert; export fn find_msb(val: usize) usize { // assert(val != 0); var v = val; var r:usize = 0; while (v != 0) : (v >>= 1) { r += 1; } return r; } It compiles to: [1] example.find_msb: lzcnt rcx, rdi mov eax, 64 sub rax, rcx test rdi, rdi cmove rax, rdi ret find_msb = ...
0 comments
No comments yet.