Overview
| Comment: | Add some PowerPC assembly optimizations. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
37e9b7c11cb5e9770bc9cb20a00f9e47 |
| User & Date: | js on 2009-08-30 20:06:15 |
| Other Links: | manifest | tags |
Context
|
2009-08-31
| ||
| 00:19 | Optimize OF_BSWAP64. (check-in: 2ff4ae177d user: js tags: trunk) | |
|
2009-08-30
| ||
| 20:06 | Add some PowerPC assembly optimizations. (check-in: 37e9b7c11c user: js tags: trunk) | |
|
2009-08-28
| ||
| 17:57 | Fix a bug in OFHashing (SHA1 didn't cache correctly in -[digit]). (check-in: 6a0ac6a3f1 user: js tags: trunk) | |
Changes
Modified src/OFMacros.h from [7562b69891] to [63162e95ce].
| ︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
#endif
#ifdef __GNUC__
#if defined(__amd64__) || defined(__x86_64__)
#define OF_AMD64_ASM
#elif defined(__i386__)
#define OF_X86_ASM
#endif
#endif
static OF_INLINE uint16_t
OF_BSWAP16(uint16_t i)
{
#if defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
asm("xchgb %h0, %b0" : "=Q"(i) : "Q"(i));
#else
i = (i & UINT16_C(0xFF00)) >> 8 |
(i & UINT16_C(0x00FF)) << 8;
#endif
return i;
}
static OF_INLINE uint32_t
OF_BSWAP32(uint32_t i)
{
#if defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
asm("bswap %0" : "=q"(i) : "q"(i));
#else
i = (i & UINT32_C(0xFF000000)) >> 24 |
(i & UINT32_C(0x00FF0000)) >> 8 |
(i & UINT32_C(0x0000FF00)) << 8 |
(i & UINT32_C(0x000000FF)) << 24;
#endif
return i;
| > > > > > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
#endif
#ifdef __GNUC__
#if defined(__amd64__) || defined(__x86_64__)
#define OF_AMD64_ASM
#elif defined(__i386__)
#define OF_X86_ASM
#elif defined(__ppc__) || defined(__PPC__)
#define OF_PPC_ASM
#endif
#endif
static OF_INLINE uint16_t
OF_BSWAP16(uint16_t i)
{
#if defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
asm("xchgb %h0, %b0" : "=Q"(i) : "Q"(i));
#elif defined(OF_PPC_ASM)
asm("lhbrx %0, 0, %1" : "=r"(i) : "r"(&i), "m"(i));
#else
i = (i & UINT16_C(0xFF00)) >> 8 |
(i & UINT16_C(0x00FF)) << 8;
#endif
return i;
}
static OF_INLINE uint32_t
OF_BSWAP32(uint32_t i)
{
#if defined(OF_X86_ASM) || defined(OF_AMD64_ASM)
asm("bswap %0" : "=q"(i) : "q"(i));
#elif defined(OF_PPC_ASM)
asm("lwbrx %0, 0, %1" : "=r"(i) : "r"(&i), "m"(i));
#else
i = (i & UINT32_C(0xFF000000)) >> 24 |
(i & UINT32_C(0x00FF0000)) >> 8 |
(i & UINT32_C(0x0000FF00)) << 8 |
(i & UINT32_C(0x000000FF)) << 24;
#endif
return i;
|
| ︙ | ︙ |