Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 05-10-2002, 04:06 AM
theCoder
Sarnak
 
Join Date: Jan 2002
Posts: 90
Default

Endian-ness would probably be a big barrier to porting to non-x86 architectures. I think that the Internet has a standard endian (probably big) and there are OS functions that on little endian machines flip the bits around. But I doubt the EMU uses those functions since it was derived mainly by packet sniffing.

One thing that could be done would be to encapsulate the necessary constants in a macro like ENDIAN_CORRECT. That macro could be defined like so:
Code:
#ifdef X86_ARCH
// little endian -- leave the same
#define ENDIAN_CORRECT(a) (a)
#else
// big endian -- flip the bytes
#define ENDIAN_CORRECT(a)       \
    (((a & 0x000000FF) << 24) | \
     ((a & 0x0000FF00) << 8)  | \
     ((a & 0x00FF0000) >> 8)  | \
     ((a & 0xFF000000) >> 24))
#endif
Of course, that macro would only work for 32 bit integers, but the compiler would take care of actually computing the new value instead of it being done at run time.

The trick would be making sure that every instance of a constant like this is put inside the macro, which would take a while. And I'd imagine that there are probably places in the code that assume little endian-ness that wouldn't necessairly be easy to spot.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 04:00 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3