Subject: Re: hton64
To: John F. Woods <>
From: Johan Danielsson <>
List: current-users
Date: 06/29/1997 23:46:18
"John F. Woods" <> writes:

> Does the compiler vendor not define int16_t, or is the compiler
> obligated to emulate non-addressable quantities?

With addressable you mean "ability to load N bit scalars"?

I think the usual interpretation of intN_t is at least N bits.

Jason Thorpe <> writes:

> That's what the compiler on the Cray C90 does (and it only has
> 128-bit addressability :-)

Hmm, I think that all vector crays can address 64 bit quantities.  A
short is usually 32 bits, int and long are 64 bits.  The size of all
of them is 8.

The question is whether the C-code should be truly generic, or if
(reasonable) assumptions about the hardware can be made.

_swapN(u_intN_t a, int n)
    u_intN_t b = 0;
    for(i = 0; i < 8 * n; i += 8)
	b = (b << 8) | ((a >> i) & 0xff);
    return b;