Skip to content

Commit

Permalink
- emulation版のMSB32/64 で-1をし忘れていた (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lefu777 authored Apr 5, 2024
1 parent 20009c8 commit 93edf88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/extra/bitop.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ FORCE_INLINE s32 MSB32(u32 v) {
v = v | (v >> 4);
v = v | (v >> 8);
v = v | (v >> 16);
return POPCNT32(v);
return POPCNT32(v) - 1;
}
FORCE_INLINE s32 MSB64(u64 v) {
ASSERT_LV3(v != 0);
Expand All @@ -214,7 +214,7 @@ FORCE_INLINE s32 MSB64(u64 v) {
v = v | (v >> 8);
v = v | (v >> 16);
v = v | (v >> 32);
return POPCNT64(v);
return POPCNT64(v) - 1;
}

#endif
Expand Down

0 comments on commit 93edf88

Please sign in to comment.