This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix for hal_endian.h SWAP16() macro


The SWAP16() macro is broken.

  unsigned u = SWAP16(0x1234);

u will be 0x123412 instead of 0x3412.

Here's a fix.

I believe that the SWAP32() macro will also break in a similar
way on systems where "int" is larger than 32 bits, but I have
no way to test that conjecture.

-- 
Grant Edwards
grante@visi.com

Attachment: hal_endian.h--SWAP16.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]