authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-02-09 17:12:43+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-09 14:12:01-05:00
logc4d0f97b4c3f85796c4953d6e87b5c0186616bc1
tree478f50dc11c5d2fbc548ced3dd5ed1d52a949c0e
parentb55bc5eb266f2dc62cf520e8b572893adf5f979c

compiler_rt: Fix clzsi2 implementation for Thumb1

The LUT contains the number of bits set, not the number of leading zeros as we're subtracting from the total number of bits in a word. Closes #4415

1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/special/compiler_rt/clzsi2.zig+2-1
......@@ -45,8 +45,9 @@ fn __clzsi2_thumb1() callconv(.Naked) void {
4545 \\ subs r0, r1, r0
4646 \\ bx lr
4747 \\ .p2align 2
48 \\ // Number of bits set in the 0-15 range
4849 \\ LUT:
49 \\ .byte 4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0
50 \\ .byte 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4
5051 );
5152
5253 unreachable;