FROM : Greg Parker
DATE : Thu Jan 30 12:39:01 2003
> According to what I'v read, the PowerPC is supposed to
> be able to handle both little and big endian data
> formats.
>
> Has anyone managed to compile in little endian on the
> mac (I'd like to be able to natively treat
> little-endian network packets without going through
> the hasle of converting every second field...)?
The PowerPC can do two things with little-endian data:
* The CPU itself can do everything in little-endian mode. This
doesn't help you because it needs OS support that Mac OS X
doesn't have. (I don't know whether the OS needs to be little-
endian or whether the OS can switch the CPU's endianness on
the fly for different processes. In any case, Mac OS X doesn't
do either.)
* When in big-endian mode, there are special load and store
instructions that byte-swap the data as it comes in. If you
really need the speed, you could write parts of your packet
handler in assembly and use those instructions directly.
--
Greg Parker <email_removed>
DATE : Thu Jan 30 12:39:01 2003
> According to what I'v read, the PowerPC is supposed to
> be able to handle both little and big endian data
> formats.
>
> Has anyone managed to compile in little endian on the
> mac (I'd like to be able to natively treat
> little-endian network packets without going through
> the hasle of converting every second field...)?
The PowerPC can do two things with little-endian data:
* The CPU itself can do everything in little-endian mode. This
doesn't help you because it needs OS support that Mac OS X
doesn't have. (I don't know whether the OS needs to be little-
endian or whether the OS can switch the CPU's endianness on
the fly for different processes. In any case, Mac OS X doesn't
do either.)
* When in big-endian mode, there are special load and store
instructions that byte-swap the data as it comes in. If you
really need the speed, you could write parts of your packet
handler in assembly and use those instructions directly.
--
Greg Parker <email_removed>
| Related mails | Author | Date |
|---|---|---|
| fernand reynaud | Jan 30, 06:20 | |
| Greg Parker | Jan 30, 12:39 | |
| Timothy J. Wood | Jan 30, 13:47 | |
| Bill Northcott | Jan 30, 18:47 |






Cocoa mail archive

