1 #ifndef RecoLocalCalo_HcalRecAlgos_CaloRecHitAuxSetter_h_
2 #define RecoLocalCalo_HcalRecAlgos_CaloRecHitAuxSetter_h_
7 namespace CaloRecHitAuxSetter
9 inline void setField(uint32_t* u,
const unsigned mask,
11 {*u &= ~(mask <<
offset); *u |= ((value & mask) << offset);}
13 inline unsigned getField(
const uint32_t u,
const unsigned mask,
15 {
return (u >> offset) & mask;}
17 inline void setBit(uint32_t* u,
const unsigned bitnum,
const bool b)
18 {
if (b) {*u |= (1U << bitnum);}
else {*u &= ~(1U << bitnum);}}
20 inline bool getBit(
const uint32_t u,
const unsigned bitnum)
21 {
return u & (1U << bitnum);}
24 #endif // RecoLocalCalo_HcalRecAlgos_CaloRecHitAuxSetter_h_
unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
void setBit(uint32_t *u, const unsigned bitnum, const bool b)
void setField(uint32_t *u, const unsigned mask, const unsigned offset, const unsigned value)
bool getBit(const uint32_t u, const unsigned bitnum)