diff options
author | MITSUNARI Shigeo <[email protected]> | 2024-02-22 12:55:58 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2024-02-22 12:55:58 +0900 |
commit | 78d878500e9166cfb36a411bb1506a8ec0fc4e0c (patch) | |
tree | da7303e448de33d6583af6e15f23496ab4515720 | |
parent | 16a2efaf7ffdb5900d8cd1f382cf2ea53f450f6e (diff) | |
download | xbyak-78d878500e9166cfb36a411bb1506a8ec0fc4e0c.tar.gz xbyak-78d878500e9166cfb36a411bb1506a8ec0fc4e0c.zip |
use 32bitAsBE
-rw-r--r-- | xbyak/xbyak_util.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/xbyak/xbyak_util.h b/xbyak/xbyak_util.h index d646b10..2b27afd 100644 --- a/xbyak/xbyak_util.h +++ b/xbyak/xbyak_util.h @@ -145,14 +145,15 @@ private: uint32_t dataCacheLevels_; uint32_t avx10version_; - bool compareVendorString(const uint32_t EBX, const uint32_t ECX, const uint32_t EDX, const char vendorString[12]) { - return ( - *reinterpret_cast<const uint32_t*>(&vendorString[0]) == EBX && - *reinterpret_cast<const uint32_t*>(&vendorString[4]) == EDX && - *reinterpret_cast<const uint32_t*>(&vendorString[8]) == ECX - ); + uint32_t get32bitAsBE(const char *x) const + { + return x[0] | (x[1] << 8) | (x[2] << 16) | (x[3] << 24); + } + bool compareVendorString(const uint32_t EBX, const uint32_t ECX, const uint32_t EDX, const char vendorString[12]) const + { + return get32bitAsBE(&vendorString[0]) == EBX && get32bitAsBE(&vendorString[4]) == EDX && get32bitAsBE(&vendorString[8]) == ECX; } - uint32_t extractBit(uint32_t val, uint32_t base, uint32_t end) + uint32_t extractBit(uint32_t val, uint32_t base, uint32_t end) const { return (val >> base) & ((1u << (end + 1 - base)) - 1); } |