Sorry, I jumped the gun...
bswap is only designed for the 4-byte case...
the 16-bit option below actually swaps all 4 bytes like the first option.
So it is much more efficient to use the XCHG instruction for the16-bit swap.
But I did verify that BSWAP arrived with the 486, so it will likely be there on PCs
less than 8 years old.
DIAMOND JEFF wrote:
> I just verified the syntax in Visual C++:
>
> __asm bswap eax; // swap 4 bytes in eax
> __asm bswap ax; // swap 2 bytes in ax
>
> etc, etc
>
> Prashant Gupta wrote:
>
> > Thanks for this code, Now I have a better one...
> >
> > ----- Original Message -----
> > From: "Daniel Morais" <[EMAIL PROTECTED]>
> > To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> > Sent: Wednesday, March 21, 2001 4:11 AM
> > Subject: Re: Palm to Desktop type conversions
> >
> > > Mardi 20 Mars 2001 04:39, Prashant Gupta a écrit:
> > >
> > > > Win32 (intel) Assembler Routines...
> > > > ;*********************
> > > > ;
> > > > ; INPUT: eax = source word
> > > > ; OUTPUT: eax = output converted word
> > > > ; Registers Destroyed : eax, ecx, edx
> > > > (...)
> > >
> > > Wow, do you really use this code ?
> > >
> > > If you do, please use the following one, much shorter and faster :
> > >
> > > Swap16 :
> > >
> > > xchg al, ah
> > >
> > > Swap32 :
> > >
> > > xchg al, ah
> > > rol eax , 16
> > > xchg al, ah
> > >
> > > Sorry to put some Intel ASM code in this forum...
> > >
> > > --
> > > Daniel Morais
> > >
> > > --
> > > For information on using the Palm Developer Forums, or to unsubscribe,
> > please see http://www.palmos.com/dev/tech/support/forums/
> > >
> > >
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe, please see
>http://www.palmos.com/dev/tech/support/forums/
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see
>http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/