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

Function ACLGetCommandBitCoordinates

src/acl.cpp:374–379  ·  view source on GitHub ↗

Given a command ID, this function set by reference 'word' and 'bit' * so that user->allowed_commands[word] will address the right word * where the corresponding bit for the provided ID is stored, and * so that user->allowed_commands[word]&bit will identify that specific * bit. The function returns C_ERR in case the specified ID overflows * the bitmap in the user representation. */

Source from the content-addressed store, hash-verified

372 * bit. The function returns C_ERR in case the specified ID overflows
373 * the bitmap in the user representation. */
374int ACLGetCommandBitCoordinates(uint64_t id, uint64_t *word, uint64_t *bit) {
375 if (id >= USER_COMMAND_BITS_COUNT) return C_ERR;
376 *word = id / sizeof(uint64_t) / 8;
377 *bit = 1ULL << (id % (sizeof(uint64_t) * 8));
378 return C_OK;
379}
380
381/* Check if the specified command bit is set for the specified user.
382 * The function returns 1 is the bit is set or 0 if it is not.

Callers 2

ACLGetUserCommandBitFunction · 0.85
ACLSetUserCommandBitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected