MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / set

Method set

libraries/BitArray/BitArray.cpp:87–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85
86
87uint32_t BitArray::set(const uint16_t index, uint32_t value)
88{
89 // if (_error != BA_OK) return BA_ERR;
90 // if (index >= _size) return BA_IDX_RANGE;
91 uint16_t pos = index * _bits;
92 uint32_t mask = 1UL;
93 for (uint8_t i = 0; i < _bits; i++)
94 {
95 uint8_t v = (value & mask) > 0 ? 1 : 0;
96 _bitset(pos + i, v);
97 mask <<= 1;
98 }
99 return value;
100}
101
102
103uint32_t BitArray::toggle(const uint16_t index)

Callers 1

unittestFunction · 0.45

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.36