diff options
author | MITSUNARI Shigeo <[email protected]> | 2022-05-20 09:40:22 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2022-05-20 09:40:22 +0900 |
commit | b48a7bb1b72ff4bf0c8363985ab7c3cb3c68ae7b (patch) | |
tree | 1adf88ef3f8dd43af7b5ed2e3beae5a2b525943f | |
parent | 1a90f456c6438d4568ffd0d1657a408dfb68cf3a (diff) | |
download | xbyak-b48a7bb1b72ff4bf0c8363985ab7c3cb3c68ae7b.tar.gz xbyak-b48a7bb1b72ff4bf0c8363985ab7c3cb3c68ae7b.zip |
add operator== to Type
-rw-r--r-- | xbyak/xbyak_util.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/xbyak/xbyak_util.h b/xbyak/xbyak_util.h index ab0bd57..8274ebe 100644 --- a/xbyak/xbyak_util.h +++ b/xbyak/xbyak_util.h @@ -118,6 +118,8 @@ public: t |= rhs; return t; } + bool operator==(const Type& rhs) const { return H == rhs.H && L == rhs.L; } + bool operator!=(const Type& rhs) const { return !operator==(rhs); } // without explicit because backward compatilibity operator bool() const { return (H | L) != 0; } uint64_t getL() const { return L; } @@ -179,7 +181,7 @@ private: } void setNumCores() { - if ((type_ & tINTEL) == 0) return; + if (!has(tINTEL)) return; unsigned int data[4] = {}; @@ -217,7 +219,7 @@ private: } void setCacheHierarchy() { - if ((type_ & tINTEL) == 0) return; + if (!has(tINTEL)) return; const unsigned int NO_CACHE = 0; const unsigned int DATA_CACHE = 1; // const unsigned int INSTRUCTION_CACHE = 2; @@ -561,7 +563,7 @@ public: printf("display:family=%X, model=%X\n", displayFamily, displayModel); #endif } - bool has(Type type) const + bool has(const Type& type) const { return (type & type_) == type; } |