mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-20 10:16:48 +00:00
Correct more analysis problems. No functional changes.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
@@ -9,13 +9,13 @@
|
||||
#endif
|
||||
|
||||
namespace EightBit {
|
||||
int countBits(uint8_t value);
|
||||
bool oddParity(uint8_t value);
|
||||
int findFirstSet(int value);
|
||||
int countBits(uint8_t value) noexcept ;
|
||||
bool oddParity(uint8_t value) noexcept ;
|
||||
int findFirstSet(int value) noexcept ;
|
||||
constexpr void assume(int expression);
|
||||
}
|
||||
|
||||
inline int EightBit::countBits(const uint8_t value) {
|
||||
inline int EightBit::countBits(const uint8_t value) noexcept {
|
||||
#ifdef _MSC_VER
|
||||
return __popcnt(value);
|
||||
#else
|
||||
@@ -35,11 +35,11 @@ inline int EightBit::countBits(const uint8_t value) {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool EightBit::oddParity(const uint8_t value) {
|
||||
inline bool EightBit::oddParity(const uint8_t value) noexcept {
|
||||
return countBits(value) % 2;
|
||||
}
|
||||
|
||||
inline int EightBit::findFirstSet(const int value) {
|
||||
inline int EightBit::findFirstSet(const int value) noexcept {
|
||||
#ifdef _MSC_VER
|
||||
unsigned long index;
|
||||
if (_BitScanForward(&index, value))
|
||||
|
||||
Reference in New Issue
Block a user