You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
causes overflow. long on my machine is 32-bit (printf("%ld\n", LONG_MAX); prints 2147483647), and compiler would give a warning -Wshift-count-overflow on that line. Indeed long type cannot hold that prime number.
I suspect it could be corrected as
unsigned long p = (1L<<32) - 5;
with printf("%lu\n", p); prints 4294967291, which is desired.
However the -Wshift-count-overflow warning: left shift count >= width of type still persists.
With
unsigned long p = (~0L) - 4;
(*)
the warning vanishes.
In summary, I think that line should be (*).
The text was updated successfully, but these errors were encountered:
I suspect the line
causes overflow.
long
on my machine is 32-bit (printf("%ld\n", LONG_MAX);
prints 2147483647), and compiler would give a warning-Wshift-count-overflow
on that line. Indeedlong
type cannot hold that prime number.I suspect it could be corrected as
with
printf("%lu\n", p);
prints 4294967291, which is desired.However the
-Wshift-count-overflow
warning: left shift count >= width of type still persists.With
(*)
the warning vanishes.
In summary, I think that line should be (*).
The text was updated successfully, but these errors were encountered: