Size-independent byte order swapping functions.

Mark Murray mark at grondar.org
Tue Nov 25 00:10:13 PST 2003


David Schultz writes:
> > I'm not sure if dedicated epanic() is the best way to implement out-of-rang
> e
> > errors prevention - the more handy solution should cause compile error.
> 
> See CTASSERT.

There is an extremely limited number of sizes that are possible here,
even with weird/theoretical architectures like 256-bit machines. Doesn't
it make sense just to presume that out-of-range is impossible, and recode
for default "if (sizeof(x) == 1) return x;" (ignore syntax) ?

M
--
Mark Murray
iumop ap!sdn w,I idlaH


More information about the freebsd-hackers mailing list