I am creating random integers with the following algorithm:
int random;
int i;
for (i = 0; i < RANDOM_COUNT; i++) {
random = (((int) rand() << 0) & 0x0000FFFFd)
| (((int) rand() << 16) & 0xFFFF0000d);
fprintf(outputFile, " %d\n", random);
}
I am getting the following warning:
warning: integer constant is too large for "long" type
on this line:
| (((int) rand() << 16) & 0xFFFF0000d);
I am using GCC 3.4.3 to compile the code.
Does anyone know which part of the operation is triggering the warning?
Does anyone know which part of the operation [
(((int) rand() << 16) & 0xFFFF0000d);] is triggering the warning?
Yes, it's the 0xFFFF0000d, because it's 36 bits in size. Note that this number is equal to 0xFFFF0000D. You probably meant 0xFFFF0000.
Likewise, 0x0000FFFFd is equal to 0x0000FFFFD. You probably meant 0x0000FFFF.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With