MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_setBit_at_

Function UArray_setBit_at_

libs/basekit/source/UArray_math.c:247–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247void UArray_setBit_at_(UArray *self, int aBool, size_t i) {
248 size_t bytePos = i / 8;
249 size_t bitPos = i % 8;
250 uint8_t n = 0x1 << bitPos;
251 uint8_t b;
252 if (bytePos >= UArray_sizeInBytes(self))
253 return;
254 b = self->data[bytePos];
255 b ^= n;
256 if (aBool)
257 b |= (0x1 << bitPos);
258 self->data[bytePos] = b;
259}
260
261UArray *UArray_asBits(const UArray *self) {
262 UArray *out = UArray_new();

Callers

nothing calls this directly

Calls 1

UArray_sizeInBytesFunction · 0.85

Tested by

no test coverage detected