[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Magic money not working bigendian




Robert M. Solovay writes:
 > Is there a simple way to find out if ones computer is big-endian or
 > not? [Like a simple C program that one can compile and run to settle
 > the question.]

Perhaps I can redeem myself by doing the cypherpunk thing and writing
code:

int isBigEndian()
{
	int test = 0;
	char *testP = (char *) &test;

	*testP = 0xff;

	return !(test & 0xff);
}

--
| GOOD TIME FOR MOVIE - GOING ||| Mike McNally <[email protected]>       |
| TAKE TWA TO CAIRO.          ||| Tivoli Systems, Austin, TX:        |
|     (actual fortune cookie) ||| "Like A Little Bit of Semi-Heaven" |