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

Function intsetMoveTail

src/intset.c:184–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184static void intsetMoveTail(intset *is, uint32_t from, uint32_t to) {
185 void *src, *dst;
186 uint32_t bytes = intrev32ifbe(is->length)-from;
187 uint32_t encoding = intrev32ifbe(is->encoding);
188
189 if (encoding == INTSET_ENC_INT64) {
190 src = (int64_t*)is->contents+from;
191 dst = (int64_t*)is->contents+to;
192 bytes *= sizeof(int64_t);
193 } else if (encoding == INTSET_ENC_INT32) {
194 src = (int32_t*)is->contents+from;
195 dst = (int32_t*)is->contents+to;
196 bytes *= sizeof(int32_t);
197 } else {
198 src = (int16_t*)is->contents+from;
199 dst = (int16_t*)is->contents+to;
200 bytes *= sizeof(int16_t);
201 }
202 memmove(dst,src,bytes);
203}
204
205/* Insert an integer in the intset */
206intset *intsetAdd(intset *is, int64_t value, uint8_t *success) {

Callers 2

intsetAddFunction · 0.85
intsetRemoveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected