mirror of
https://github.com/BLAKE3-team/BLAKE3
synced 2024-04-27 16:55:04 +02:00
Make sign conversion explicit. Fix #287.
Implicit sign conversions cause warnings when using -Wsign-conversion but that is easy to avoid by making the conversions explicit.
This commit is contained in:
parent
e366618d22
commit
606a5825d9
|
@ -87,7 +87,7 @@ static const uint8_t MSG_SCHEDULE[7][16] = {
|
||||||
/* x is assumed to be nonzero. */
|
/* x is assumed to be nonzero. */
|
||||||
static unsigned int highest_one(uint64_t x) {
|
static unsigned int highest_one(uint64_t x) {
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
return 63 ^ __builtin_clzll(x);
|
return 63 ^ (unsigned int)__builtin_clzll(x);
|
||||||
#elif defined(_MSC_VER) && defined(IS_X86_64)
|
#elif defined(_MSC_VER) && defined(IS_X86_64)
|
||||||
unsigned long index;
|
unsigned long index;
|
||||||
_BitScanReverse64(&index, x);
|
_BitScanReverse64(&index, x);
|
||||||
|
@ -117,7 +117,7 @@ static unsigned int highest_one(uint64_t x) {
|
||||||
// Count the number of 1 bits.
|
// Count the number of 1 bits.
|
||||||
INLINE unsigned int popcnt(uint64_t x) {
|
INLINE unsigned int popcnt(uint64_t x) {
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
return __builtin_popcountll(x);
|
return (unsigned int)__builtin_popcountll(x);
|
||||||
#else
|
#else
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
while (x != 0) {
|
while (x != 0) {
|
||||||
|
|
Loading…
Reference in New Issue