Skip to content

Commit

Permalink
bitmap: _BitScanForward returns index not nr, fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
asamy committed May 27, 2017
1 parent d650239 commit b895792
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static inline unsigned long __ffs(unsigned long x)
#ifdef _MSC_VER
unsigned long i;
_BitScanForward(&i, x);
return i;
return i + 1;
#else
return __builtin_ffs(x);
#endif
Expand All @@ -85,7 +85,7 @@ static inline unsigned long __ffz(unsigned long x)
#ifdef _MSC_VER
unsigned long i;
_BitScanForward(&i, ~x);
return i;
return i + 1;
#else
return __builtin_ffs(~x);
#endif
Expand Down

0 comments on commit b895792

Please sign in to comment.