x86 supports bswap, like “bswap eax”. This can be wrapped by the appropriate c/c++ wrapper incantations so that it works inline.
-----Original Message-----
From: Mathieu Routhier [mailto:xxxxx@guillemot.com]
Sent: Wednesday, May 14, 2003 8:44 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Byte Order APIs.
Too bad RtlUlongByteSwap() and such are not implemented in 98/me…
In a past project, we used to have a piece of code that was meant to be run
on both types of processors (little AND big endian). We could not directly
use a byte swap function or macro because swapping was not always required:
the intent was to convert from data in a known byte-ordering format to the
format of the platform on which the code was running.
Ultimately, we had a macro called something like LITTLEENDIAN_TO_PLATFORM
that resolved to something different depending of the platform for which the
code was compiled. That was pretty neat actually. It’s a little bit like
the ntohl and similar functions, I guess.
System support for swapping is not a bad thing, but OTOH, I find it weird to
call a function for performing such a basic operation; it feels weird, like
calling a function to add two values…
I wish there was an assembly operation to do byte swaps! That would be so
quicker to do, instead of shifting and ORing.
Mat
-----Original Message-----
From: Roddy, Mark [mailto:xxxxx@stratus.com]
Sent: Wednesday, May 14, 2003 9:10 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Byte Order APIs.
You use the DDK versions and the DDK versions do the appropriate thing for
the platform. Besides, all NT platforms are little endian, always have been,
and for the foreseeable future, always will be.
-----Original Message-----
From: xxxxx@planet.nl [mailto:xxxxx@planet.nl]
Sent: Wednesday, May 14, 2003 8:50 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Byte Order APIs.
In case of using both RtlUlongByteSwap c.s. and these
“home-made” functions you assume that the host-byte order is
little endian.
See also this Fine Material: 
http://www.cs.rpi.edu/courses/sysprog/sockets/byteorder.html
So you might take some care here. Is your software supposed to work on
non-i368 platforms?
Jan Roeloffzen.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Walter Oney
Sent: Wednesday, May 14, 2003 12:08 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Byte Order APIs.
“Mark S. Edwards” wrote:
> Have to roll your own, try
No you don’t – RTFM and find RtlUlongByteSwap and related functions.
–
Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Now teaming with John Hyde for USB Device Engineering Seminars Check
out our schedule at http://www.oneysoft.com
You are currently subscribed to ntdev as: xxxxx@planet.nl To
unsubscribe send a blank email to xxxxx@lists.osr.com
You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com
You are currently subscribed to ntdev as: xxxxx@guillemot.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
You are currently subscribed to ntdev as: xxxxx@interactivesi.com
To unsubscribe send a blank email to xxxxx@lists.osr.com