numbers you may simply right shift the numbers, until their leading bit (MSB) is different. e.g.
(I'm pretty sure there are more efficient ways, have a look, if you can at "Hacker's Delight"
int compare(unsigned int a, unsigned int b);
unsigned int a, b;
for (i = 1; i<20; i++)
printf("%u is smaller than %u\n", a, b);
printf("%u is equal to %u\n", a, b);
printf("%u is greater than %u\n", a, b);
int compare(unsigned int a, unsigned int b)
unsigned int fb = 1 << (sizeof(a)*8-1);
while ( !( (a ^ b) & fb))
a <<= 1;
b <<= 1;
if (!a && !b) return 0;
if ( a & fb)