Skip to content

Commit a2196ec

Browse files
committed
[interpreter] Make popcnt loop up to bitwidth
This makes it work for Rep.bitwidth < 32. Otherwise it will keep checking all 32 bits and give the wrong result.
1 parent 9a0269b commit a2196ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

interpreter/exec/int.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ struct
199199

200200
let popcnt x =
201201
let rec loop acc i n =
202-
if n = Rep.zero then
202+
if i = 0 then
203203
acc
204204
else
205205
let acc' = if and_ n Rep.one = Rep.one then acc + 1 else acc in

0 commit comments

Comments
 (0)