#define SCALE (1 << 31)
#define fix_Q31_80(x) ( (int) ( (float)(x)*(float)0x80000000 ) )
#define fix_Q31_SC(x) ( (int) ( (float)(x)*(float)SCALE ) )
int
1 << 31
is undefined behavior on most platforms (e. g., systems with 16-bit or 32-bit int
) as its result cannot be represented in an int
(the resulting type of the expression). Don't use that expression in code. On the other hand 1U << 31
is a valid expression on systems with 32-bit int
as its result is representable in an unsigned int
(the resulting type of the expression).
On a 32-bit int
system, 0x80000000
is a (relatively) big positive integer number of type unsigned int
. If you are lucky (or unlucky) enough to not have demons to fly out of your nose by using 1 << 31
expression, the most likely result of this expression is INT_MIN
which is a (relatively) big negative integer number of type int
.