MCPcopy Create free account
hub / github.com/F-Stack/f-stack / getUnsignedBitfield

Function getUnsignedBitfield

app/redis-6.2.6/src/bitops.c:229–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229uint64_t getUnsignedBitfield(unsigned char *p, uint64_t offset, uint64_t bits) {
230 uint64_t byte, bit, byteval, bitval, j, value = 0;
231
232 for (j = 0; j < bits; j++) {
233 byte = offset >> 3;
234 bit = 7 - (offset & 0x7);
235 byteval = p[byte];
236 bitval = (byteval >> bit) & 1;
237 value = (value<<1) | bitval;
238 offset++;
239 }
240 return value;
241}
242
243int64_t getSignedBitfield(unsigned char *p, uint64_t offset, uint64_t bits) {
244 int64_t value;

Callers 2

getSignedBitfieldFunction · 0.85
bitfieldGenericFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected