[TriLUG] OT: network byte order double swapping
Brian Weaver
cmdrclueless at gmail.com
Mon Apr 4 12:51:40 EDT 2005
Ed,
Any chance you could enlighten those of us without access to 64-bit
machines what the sizeof operator returns in your little program?
BTW, I don't doubt someone familiar with X-86 assembly could write a
better optimized routine. My example was just that, an example of how
you could swap the bytes. I never claimed that it was "bug" free =).
-Brian "Stuck in the 32-bit world" Weaver
On Apr 4, 2005 12:40 PM, Ed Hill <ed at eh3.com> wrote:
> The above looks like it will work on some machines, but IT IS NOT 64-bit
> CLEAN AND THUS YOU SHOULD AVOID IT !!! For instance, try:
>
> cat > tst.c <<EOFF
> #include "stdio.h"
> int main (int argc, char ** argv)
> {
> printf("sizeof(long) = %d\n",sizeof(long));
> printf("sizeof(unsigned long) = %d\n",sizeof(unsigned long));
> return 0;
> }
> EOF
> make tst
> ./tst
>
> on AMD64 (x86_64) system and see why.
>
More information about the TriLUG
mailing list