digitalmars.D.bugs - [Issue 2117] New: Please add more byteswapping support
- d-bugmail puremagic.com May 20 2008
- "Janice Caron" <caron800 googlemail.com> May 20 2008
- Ingo Oeser <ioe-news rameria.de> May 24 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2117 Summary: Please add more byteswapping support Product: D Version: 2.014 Platform: PC OS/Version: Linux Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: jlquinn optonline.net Right now there is limited support for byteswapping. std.intrinsic includes bswap(uint), and std.system includes a predefined constant for system endianness. It would be really helpful to have bswap equivalents for all basic datatypes, as well as routines to swap between native endianness and explicit big or little endian, ala ntohl, ntohs, htonl, htons A related thing that would come in handy is byteswapping mmap support. --
May 20 2008
On 20/05/2008, d-bugmail puremagic.com <d-bugmail puremagic.com> wrote:It would be really helpful to have bswap equivalents for all basic datatypes,
Essentially, bswap(T)(T x)as well as routines to swap between native endianness and explicit big or little endian, ala ntohl, ntohs, htonl, htons
I never did understand the difference between ntoh* and hton*. :-)
May 20 2008
Janice Caron wrote:I never did understand the difference between ntoh* and hton*. :-)
It is a semantic difference only, not a behavioral one. You can deduce the expected and actual endianess when using the semantically correct transformation. This helps (static) checkers like e.g. sparse on Linux. Best Regards Ingo Oeser
May 24 2008








Ingo Oeser <ioe-news rameria.de>