[lkml]   [2009]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] x86: do not expose CONFIG_BSWAP to userspace
Harvey Harrison <> writes:

> Is there a byteswap builtin in gcc? At least AVR32
> seems to use it, but perhaps it's not generally exposed...perhaps we
> could ask the gcc-folk?

Yes, GCC has byteswap builtins on x86 documented as follows:

-- Built-in Function: int32_t __builtin_bswap32 (int32_t x)
Returns X with the order of the bytes reversed; for example,
`0xaabbccdd' becomes `0xddccbbaa'. Byte here always means exactly
8 bits.

-- Built-in Function: int64_t __builtin_bswap64 (int64_t x)
Similar to `__builtin_bswap32', except the argument and return
types are 64-bit.

These were only added as of GCC 4.3 though.
Ben Pfaff

 \ /
  Last update: 2009-01-29 00:05    [W:0.258 / U:0.444 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site