Subject: Re: hton64
To: Todd Vierling <tv@pobox.com>
From: Johan Danielsson <joda@pdc.kth.se>
List: current-users
Date: 06/29/1997 16:36:58
Todd Vierling <tv@pobox.com> writes:

>  Comments?

Whoa! On a popular machine around here this test program gives the
following result:

------------------------------
main()
{
  int16_t a = 0x1122;
  int32_t b = 0x11223344;
  int64_t c = 0x1122334455667788;
  printf("%lx\n", (long)_swap16(a));
  printf("%lx\n", (long)_swap32(b));
  printf("%lx\n", (long)_swap64(c));
}
------------------------------
$ ./a.out 
0
0
8877665544332211

You are assuming that int16_t has exactly 16 bits of precision, and a
sizeof == 2. Someone else has to tell whether this is an issue.

/Johan