Thread overview
[Issue 2117] New: Please add more byteswapping support
May 20, 2008
d-bugmail
May 20, 2008
Janice Caron
May 24, 2008
Ingo Oeser
Aug 01, 2011
Jonathan M Davis
May 20, 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 24, 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

August 01, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2117


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jmdavisProg@gmx.com
         Resolution|                            |FIXED


--- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-07-31 19:46:42 PDT ---
Fixed with https://github.com/D-Programming-Language/phobos/tree/10ef435bc416c2e41bef9be7119a00d9fd305cda

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------