2007/10/18

Soft-boiled egg cracking

Endianness is great make-work and telling the which orientation a box is at runtime is interesting (especially as some architectures are bi) - snippet derived from the IBM article:

int
main(int argc, char* argv[])
{
int i = 1;
char *p = (char *)&i;

if (p[0] == 1)
printf("little endian\n");
else
printf("big endian\n");

return 0;
}

Anyway, HP-UX on Itanium is big (as was/is PA-RISC), linux on Intel is little.

No comments: