ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::MaskUtils Namespace Reference

Functions

template<unsigned int bit, unsigned int end, typename T = unsigned int>
static consteval T createMask ()
 Convenience method to create a mask for which exactly one contiguous sequence of bits is set to 1.

Function Documentation

◆ createMask()

template<unsigned int bit, unsigned int end, typename T = unsigned int>
consteval T InDet::MaskUtils::createMask ( )
staticconsteval

Convenience method to create a mask for which exactly one contiguous sequence of bits is set to 1.

Template Parameters
bitlowest bit of the sequence
endthe first bit not part of this sequence must be larger or equal (for an empty mask) )to bit.

Definition at line 17 of file ModuleKeyHelper.h.

17 {
18 if constexpr(bit>31u) {
19 return static_cast<T>(0u);
20 }
21 else if constexpr(bit>=end) {
22 return static_cast<T>(0u);
23 }
24 else {
25 return static_cast<T>(1u<<bit) | createMask<bit+1u,end, T>();
26 }
27 }
static consteval T createMask()
Convenience method to create a mask for which exactly one contiguous sequence of bits is set to 1.