3 Feb 2004 11:38
Re: Size-independent byte order swapping functions.
Pawel Jakub Dawidek <pjd <at> FreeBSD.org>
2004-02-03 10:38:04 GMT
2004-02-03 10:38:04 GMT
On Tue, Feb 03, 2004 at 11:01:55AM +0100, Poul-Henning Kamp wrote: +> >I'm planning to commit this patch: +> > +> > http://garage.freebsd.pl/patches/endian.h.patch +> +> I have a hard time seeing a sensible use for these. +> +> Endianess conversion is almost exclusively used in communications +> (even if the "transmission media" is a disk), and I can't possibly +> see how it can make sense to be lax about wordsize but strict about +> byteordering. +> +> Could you please tell us what you need these for and why you could +> not use the explicitly sized families of endian functions ? I found them very useful while doing many such translations. It protect from problems when you need to manage many such transformations. For example, you have some structure: struct mystruct { uint16_t ms_foo; uint32_t ms_bar; uint64_t ms_foobar; }; and many places where you translate those fields. Suddenly, you need to change size of one of those fields. If you were using size-independent functions you don't need to change anything else, in other case diff will be much bigger with much(Continue reading)
RSS Feed