Skip to content

Commit

Permalink
update significant bit count
Browse files Browse the repository at this point in the history
  • Loading branch information
GelilaSeifu committed Apr 29, 2021
1 parent 6b39d7e commit 2b372f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hexl/util/msvc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,16 @@ inline uint64_t SignificantBitLength(const uint64_t* value) {

// second 64bit block
_BitScanReverse64(&count, *(value + 1));
if (count > 0) {
if (count >= 0 && *(value + 1) > 0) {
return static_cast<uint64_t>(count) + 1 + 64;
}

// first 64bit block
_BitScanReverse64(&count, *value);
return static_cast<uint64_t>(count) + 1;
if (count >= 0 && *(value) > 0) {
return static_cast<uint64_t>(count) + 1;
}
return 0;
}

/// @brief Checks if input is negative number
Expand Down

0 comments on commit 2b372f8

Please sign in to comment.