aboutsummaryrefslogtreecommitdiff
path: root/C/CpuArch.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--C/CpuArch.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/C/CpuArch.h b/C/CpuArch.h
index 683cfaa..a6297ea 100644
--- a/C/CpuArch.h
+++ b/C/CpuArch.h
@@ -1,5 +1,5 @@
1/* CpuArch.h -- CPU specific code 1/* CpuArch.h -- CPU specific code
22024-06-17 : Igor Pavlov : Public domain */ 2Igor Pavlov : Public domain */
3 3
4#ifndef ZIP7_INC_CPU_ARCH_H 4#ifndef ZIP7_INC_CPU_ARCH_H
5#define ZIP7_INC_CPU_ARCH_H 5#define ZIP7_INC_CPU_ARCH_H
@@ -509,11 +509,19 @@ problem-4 : performace:
509 509
510#if defined(MY_CPU_LE_UNALIGN) && defined(Z7_CPU_FAST_BSWAP_SUPPORTED) 510#if defined(MY_CPU_LE_UNALIGN) && defined(Z7_CPU_FAST_BSWAP_SUPPORTED)
511 511
512#if 0
513// Z7_BSWAP16 can be slow for x86-msvc
514#define GetBe16_to32(p) (Z7_BSWAP16 (*(const UInt16 *)(const void *)(p)))
515#else
516#define GetBe16_to32(p) (Z7_BSWAP32 (*(const UInt16 *)(const void *)(p)) >> 16)
517#endif
518
512#define GetBe32(p) Z7_BSWAP32 (*(const UInt32 *)(const void *)(p)) 519#define GetBe32(p) Z7_BSWAP32 (*(const UInt32 *)(const void *)(p))
513#define SetBe32(p, v) { (*(UInt32 *)(void *)(p)) = Z7_BSWAP32(v); } 520#define SetBe32(p, v) { (*(UInt32 *)(void *)(p)) = Z7_BSWAP32(v); }
514 521
515#if defined(MY_CPU_LE_UNALIGN_64) 522#if defined(MY_CPU_LE_UNALIGN_64)
516#define GetBe64(p) Z7_BSWAP64 (*(const UInt64 *)(const void *)(p)) 523#define GetBe64(p) Z7_BSWAP64 (*(const UInt64 *)(const void *)(p))
524#define SetBe64(p, v) { (*(UInt64 *)(void *)(p)) = Z7_BSWAP64(v); }
517#endif 525#endif
518 526
519#else 527#else
@@ -536,11 +544,27 @@ problem-4 : performace:
536#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4)) 544#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
537#endif 545#endif
538 546
547#ifndef SetBe64
548#define SetBe64(p, v) { Byte *_ppp_ = (Byte *)(p); UInt64 _vvv_ = (v); \
549 _ppp_[0] = (Byte)(_vvv_ >> 56); \
550 _ppp_[1] = (Byte)(_vvv_ >> 48); \
551 _ppp_[2] = (Byte)(_vvv_ >> 40); \
552 _ppp_[3] = (Byte)(_vvv_ >> 32); \
553 _ppp_[4] = (Byte)(_vvv_ >> 24); \
554 _ppp_[5] = (Byte)(_vvv_ >> 16); \
555 _ppp_[6] = (Byte)(_vvv_ >> 8); \
556 _ppp_[7] = (Byte)_vvv_; }
557#endif
558
539#ifndef GetBe16 559#ifndef GetBe16
560#ifdef GetBe16_to32
561#define GetBe16(p) ( (UInt16) GetBe16_to32(p))
562#else
540#define GetBe16(p) ( (UInt16) ( \ 563#define GetBe16(p) ( (UInt16) ( \
541 ((UInt16)((const Byte *)(p))[0] << 8) | \ 564 ((UInt16)((const Byte *)(p))[0] << 8) | \
542 ((const Byte *)(p))[1] )) 565 ((const Byte *)(p))[1] ))
543#endif 566#endif
567#endif
544 568
545 569
546#if defined(MY_CPU_BE) 570#if defined(MY_CPU_BE)
@@ -589,6 +613,11 @@ problem-4 : performace:
589#endif 613#endif
590 614
591 615
616#ifndef GetBe16_to32
617#define GetBe16_to32(p) GetBe16(p)
618#endif
619
620
592#if defined(MY_CPU_X86_OR_AMD64) \ 621#if defined(MY_CPU_X86_OR_AMD64) \
593 || defined(MY_CPU_ARM_OR_ARM64) \ 622 || defined(MY_CPU_ARM_OR_ARM64) \
594 || defined(MY_CPU_PPC_OR_PPC64) 623 || defined(MY_CPU_PPC_OR_PPC64)
@@ -617,6 +646,7 @@ BoolInt CPU_IsSupported_SSE2(void);
617BoolInt CPU_IsSupported_SSSE3(void); 646BoolInt CPU_IsSupported_SSSE3(void);
618BoolInt CPU_IsSupported_SSE41(void); 647BoolInt CPU_IsSupported_SSE41(void);
619BoolInt CPU_IsSupported_SHA(void); 648BoolInt CPU_IsSupported_SHA(void);
649BoolInt CPU_IsSupported_SHA512(void);
620BoolInt CPU_IsSupported_PageGB(void); 650BoolInt CPU_IsSupported_PageGB(void);
621 651
622#elif defined(MY_CPU_ARM_OR_ARM64) 652#elif defined(MY_CPU_ARM_OR_ARM64)
@@ -634,6 +664,7 @@ BoolInt CPU_IsSupported_SHA1(void);
634BoolInt CPU_IsSupported_SHA2(void); 664BoolInt CPU_IsSupported_SHA2(void);
635BoolInt CPU_IsSupported_AES(void); 665BoolInt CPU_IsSupported_AES(void);
636#endif 666#endif
667BoolInt CPU_IsSupported_SHA512(void);
637 668
638#endif 669#endif
639 670