MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / _intsetGetEncoded

Function _intsetGetEncoded

src/intset.c:56–74  ·  view source on GitHub ↗

Return the value at pos, given an encoding. */

Source from the content-addressed store, hash-verified

54
55/* Return the value at pos, given an encoding. */
56static int64_t _intsetGetEncoded(intset *is, int pos, uint8_t enc) {
57 int64_t v64;
58 int32_t v32;
59 int16_t v16;
60
61 if (enc == INTSET_ENC_INT64) {
62 memcpy(&v64,((int64_t*)is->contents)+pos,sizeof(v64));
63 memrev64ifbe(&v64);
64 return v64;
65 } else if (enc == INTSET_ENC_INT32) {
66 memcpy(&v32,((int32_t*)is->contents)+pos,sizeof(v32));
67 memrev32ifbe(&v32);
68 return v32;
69 } else {
70 memcpy(&v16,((int16_t*)is->contents)+pos,sizeof(v16));
71 memrev16ifbe(&v16);
72 return v16;
73 }
74}
75
76/* Return the value at pos, using the configured encoding. */
77static int64_t _intsetGet(intset *is, int pos) {

Callers 2

_intsetGetFunction · 0.85
intsetUpgradeAndAddFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected