Branchless: Introduce TrueMask and FalseMask constants.
This commit is contained in:
@@ -52,8 +52,8 @@ public:
|
|||||||
uint8_t padSizeIncrement = 1;
|
uint8_t padSizeIncrement = 1;
|
||||||
uint8_t padSize = 0;
|
uint8_t padSize = 0;
|
||||||
|
|
||||||
uint8_t encountered0x80 = 0x00;
|
uint8_t encountered0x80 = Branchless::FalseMask;
|
||||||
uint8_t onlyZerosPast0x80 = 0xFF;
|
uint8_t onlyZerosPast0x80 = Branchless::TrueMask;
|
||||||
|
|
||||||
InputIt it = end;
|
InputIt it = end;
|
||||||
while (it != begin && padSize < std::numeric_limits<uint8_t>::max())
|
while (it != begin && padSize < std::numeric_limits<uint8_t>::max())
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ namespace Chaos::Service
|
|||||||
|
|
||||||
struct Branchless
|
struct Branchless
|
||||||
{
|
{
|
||||||
|
static constexpr uint8_t FalseMask = 0x00;
|
||||||
|
static constexpr uint8_t TrueMask = 0xFF;
|
||||||
|
|
||||||
template<typename OutUInt, typename InUInt>
|
template<typename OutUInt, typename InUInt>
|
||||||
static constexpr OutUInt MsbMask(InUInt in) noexcept
|
static constexpr OutUInt MsbMask(InUInt in) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user