64-bit division on 32-bit arch - where's the compiler error?
Posted Aug 26, 2011 4:53 UTC (Fri) by
pr1268 (subscriber, #24648)
In reply to:
Question about Linus' QOTW by blitzkrieg3
Parent article:
Quotes of the week
Now I've another question: where's the compile error? The following code compiles and runs fine on my decrepit 32-bit P4:
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char* argv[])
{
uint64_t val = 0;
if (argc > 1)
val = strtoull(argv[1], 0, 10);
if (val > 2)
val /= 2; /* or val >>= 1; */
(void) fprintf(stdout, "%llu\n", val);
return 0;
}
Or are there 32-bit non-x86 architectures on which Linux runs which don't have such support for 64-bit integral operations? (And if so, just curious, which archs?) Thanks!
(
Log in to post comments)