u_bitwise: Switch from static const int to defines.

Sadly MSVC didn't believe those were constant,
and this is a C file so no constexpr.
This commit is contained in:
Ryan Pavlik 2020-10-08 16:57:48 -05:00
parent 1750bb672f
commit 48eb00f1c8

View file

@ -33,8 +33,8 @@ get_bits(const unsigned char *b, int start, int num)
int
sign_extend_13(uint32_t i)
{
static const size_t incoming_int_width = 13;
static const size_t adjustment =
(sizeof(i) * CHAR_BIT) - incoming_int_width;
return ((int)(i << adjustment)) >> adjustment;
#define INCOMING_INT_WIDTH (13)
#define ADJUSTMENT ((sizeof(i) * CHAR_BIT) - INCOMING_INT_WIDTH)
return ((int)(i << ADJUSTMENT)) >> ADJUSTMENT;
}