diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2015-11-03 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:57 +0300 |
commit | 7c8a265a15125b64808e695882acd2a0298ebce4 (patch) | |
tree | 81fc9fdedc6b70b979a3dfe3a3041457a6e9468d /C | |
parent | a663a6deb7a150f935fac7efdbf4d53d27369594 (diff) |
15.1015.10
Diffstat (limited to 'C')
-rw-r--r-- | C/7zVersion.h | 8 | ||||
-rw-r--r-- | C/CpuArch.h | 42 |
2 files changed, 35 insertions, 15 deletions
diff --git a/C/7zVersion.h b/C/7zVersion.h index 7e98b1c0..6ffb8e2a 100644 --- a/C/7zVersion.h +++ b/C/7zVersion.h @@ -1,9 +1,9 @@ #define MY_VER_MAJOR 15 -#define MY_VER_MINOR 9 +#define MY_VER_MINOR 10 #define MY_VER_BUILD 0 -#define MY_VERSION_NUMBERS "15.09" -#define MY_VERSION "15.09 beta" -#define MY_DATE "2015-10-16" +#define MY_VERSION_NUMBERS "15.10" +#define MY_VERSION "15.10 beta" +#define MY_DATE "2015-11-01" #undef MY_COPYRIGHT #undef MY_VERSION_COPYRIGHT_DATE #define MY_AUTHOR_NAME "Igor Pavlov" diff --git a/C/CpuArch.h b/C/CpuArch.h index ddd27d26..fa44160a 100644 --- a/C/CpuArch.h +++ b/C/CpuArch.h @@ -1,5 +1,5 @@ /* CpuArch.h -- CPU specific code -2015-08-02: Igor Pavlov : Public domain */ +2015-10-31: Igor Pavlov : Public domain */ #ifndef __CPU_ARCH_H #define __CPU_ARCH_H @@ -10,14 +10,18 @@ EXTERN_C_BEGIN /* MY_CPU_LE means that CPU is LITTLE ENDIAN. -If MY_CPU_LE is not defined, we don't know about that property of platform (it can be LITTLE ENDIAN). +MY_CPU_BE means that CPU is BIG ENDIAN. +If MY_CPU_LE and MY_CPU_BE are not defined, we don't know about ENDIANNESS of platform. MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses. -If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of platform. */ -#if defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__) -#define MY_CPU_AMD64 +#if defined(_M_X64) \ + || defined(_M_AMD64) \ + || defined(__x86_64__) \ + || defined(__AMD64__) \ + || defined(__amd64__) + #define MY_CPU_AMD64 #endif #if defined(MY_CPU_AMD64) \ @@ -52,10 +56,6 @@ If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of pla #define MY_CPU_IA64_LE #endif -#if defined(MY_CPU_X86_OR_AMD64) -#define MY_CPU_LE_UNALIGN -#endif - #if defined(MY_CPU_X86_OR_AMD64) \ || defined(MY_CPU_ARM_LE) \ || defined(MY_CPU_IA64_LE) \ @@ -65,7 +65,8 @@ If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of pla || defined(__AARCH64EL__) \ || defined(__MIPSEL__) \ || defined(__MIPSEL) \ - || defined(_MIPSEL) + || defined(_MIPSEL) \ + || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) #define MY_CPU_LE #endif @@ -76,7 +77,9 @@ If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of pla || defined(__MIPSEB__) \ || defined(__MIPSEB) \ || defined(_MIPSEB) \ - || defined(__m68k__) + || defined(__m68k__) \ + || defined(__s390x__) \ + || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) #define MY_CPU_BE #endif @@ -85,6 +88,14 @@ Stop_Compiling_Bad_Endian #endif +#ifdef MY_CPU_LE + #if defined(MY_CPU_X86_OR_AMD64) \ + /* || defined(__AARCH64EL__) */ + #define MY_CPU_LE_UNALIGN + #endif +#endif + + #ifdef MY_CPU_LE_UNALIGN #define GetUi16(p) (*(const UInt16 *)(const void *)(p)) @@ -128,6 +139,8 @@ Stop_Compiling_Bad_Endian #if defined(MY_CPU_LE_UNALIGN) && /* defined(_WIN64) && */ (_MSC_VER >= 1300) +/* Note: we use bswap instruction, that is unsupported in 386 cpu */ + #include <stdlib.h> #pragma intrinsic(_byteswap_ulong) @@ -137,6 +150,13 @@ Stop_Compiling_Bad_Endian #define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = _byteswap_ulong(v) +#elif defined(MY_CPU_LE_UNALIGN) && defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + +#define GetBe32(p) __builtin_bswap32(*(const UInt32 *)(const Byte *)(p)) +#define GetBe64(p) __builtin_bswap64(*(const UInt64 *)(const Byte *)(p)) + +#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = __builtin_bswap32(v) + #else #define GetBe32(p) ( \ |