Overview
Comment: | Fix inline assembly on x86_64 for gcc with -O. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
1f38dbc88e6ab24bc3795568fd79c54b |
User & Date: | js on 2009-11-29 14:00:12 |
Other Links: | manifest | tags |
Context
2009-11-29
| ||
16:23 | Allow NULL as parameter for -[freeMemory:]. check-in: d57228d9d6 user: js tags: trunk | |
14:00 | Fix inline assembly on x86_64 for gcc with -O. check-in: 1f38dbc88e user: js tags: trunk | |
11:49 | Let OF_BSWAP{16,32,64} automatically detect whether we swap a constant. check-in: f4d5af029a user: js tags: trunk | |
Changes
Modified src/OFMacros.h from [4ccaecc03a] to [084aac77e1].
︙ | ︙ | |||
68 69 70 71 72 73 74 | ((uint64_t)i & UINT64_C(0x000000000000FF00)) << 40 | \ ((uint64_t)i & UINT64_C(0x00000000000000FF)) << 56) static OF_INLINE uint16_t OF_BSWAP16_NONCONST(uint16_t i) { #if defined(OF_X86_ASM) || defined(OF_AMD64_ASM) | | | | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | ((uint64_t)i & UINT64_C(0x000000000000FF00)) << 40 | \ ((uint64_t)i & UINT64_C(0x00000000000000FF)) << 56) static OF_INLINE uint16_t OF_BSWAP16_NONCONST(uint16_t i) { #if defined(OF_X86_ASM) || defined(OF_AMD64_ASM) asm("xchgb %h0, %b0" : "=Q"(i) : "0"(i)); #elif defined(OF_PPC_ASM) asm("lhbrx %0, 0, %1" : "=r"(i) : "r"(&i), "m"(i)); #elif defined(OF_ARM_ASM) asm("rev16 %0, %0" : "=r"(i) : "0"(i)); #else i = (i & UINT16_C(0xFF00)) >> 8 | (i & UINT16_C(0x00FF)) << 8; #endif return i; } static OF_INLINE uint32_t OF_BSWAP32_NONCONST(uint32_t i) { #if defined(OF_X86_ASM) || defined(OF_AMD64_ASM) asm("bswap %0" : "=q"(i) : "0"(i)); #elif defined(OF_PPC_ASM) asm("lwbrx %0, 0, %1" : "=r"(i) : "r"(&i), "m"(i)); #elif defined(OF_ARM_ASM) asm("rev %0, %0" : "=r"(i) : "0"(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; } static OF_INLINE uint64_t OF_BSWAP64_NONCONST(uint64_t i) { #if defined(OF_AMD64_ASM) asm("bswap %0" : "=r"(i) : "0"(i)); #elif defined(OF_X86_ASM) asm("bswap %%eax\n\t" "bswap %%edx\n\t" "xchgl %%eax, %%edx" : "=A"(i): "0"(i)); #else i = (uint64_t)OF_BSWAP32(i & 0xFFFFFFFF) << 32 | OF_BSWAP32(i >> 32); #endif return i; } #ifdef __GNUC__ |
︙ | ︙ |