mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-25 17:29:19 +00:00
Use bswap instruction on IA-32 too. Optimize bswap_64 on little-endian
(x86 for now) systems.
This commit is contained in:
parent
6a214d48b0
commit
9da81c79a2
@ -139,7 +139,7 @@ typedef int64 intptr;
|
||||
**/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(__x86_64__)
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
// Linux/AMD64 currently has no asm optimized bswap_32() in <byteswap.h>
|
||||
#define opt_bswap_32 do_opt_bswap_32
|
||||
static inline uint32 do_opt_bswap_32(uint32 x)
|
||||
@ -184,6 +184,14 @@ static inline uint32 generic_bswap_32(uint32 x)
|
||||
((x & 0x000000ff) << 24) );
|
||||
}
|
||||
|
||||
#if defined(__i386__)
|
||||
#define opt_bswap_64 do_opt_bswap_64
|
||||
static inline uint64 do_opt_bswap_64(uint64 x)
|
||||
{
|
||||
return (bswap_32(x >> 32) | (((uint64)bswap_32((uint32)x)) << 32));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef opt_bswap_64
|
||||
#undef bswap_64
|
||||
#define bswap_64 opt_bswap_64
|
||||
|
Loading…
Reference in New Issue
Block a user