[llvm-commits] [PATCH][System] Add SwapByteOrder and move implementation from Support/MathExtras.h.

Chris Lattner clattner at apple.com
Wed Sep 15 15:50:33 PDT 2010


On Sep 14, 2010, at 2:31 PM, Michael Spencer wrote:

> On Tue, Sep 14, 2010 at 5:18 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
>> The attached patch adds the SwapByteOrder function template to System.
>> This patch is a
>> prerequisite for the object file library I am writing.
>> 
>> I want to replace the functions in MathExtras.h with SwapByteOrder
>> because it is a generic implementation that makes it easier to write
>> generic byte order independent code. This patch has no functionality
>> changes.
>> 
>> The optimized versions are platform dependent, and thus belong in System anyway.
>> 
>> - Michael Spencer
>> 
> 
> It had to happen eventually :(. Now the patch it attached.

Hi Michael,

What's wrong with the existing ByteSwap_XX functions?  Why is a template better?  Can you give an example of how this is better?

Note that you're likely to run into problems on some systems (cygwin?) where uint32_t != unsigned.

-Chris



More information about the llvm-commits mailing list