![]() |
Bit operations. Create bit operations used in aerospike_key_operate(). Offset orientation is left-to-right. Negative offsets are supported. If the offset is negative, the offset starts backwards from end of the bitmap. If an offset is out of bounds, a parameter error will be returned.
Code examples:
Bit operations on bitmap items nested in lists/maps are not currently supported by the server. The as_cdt_ctx argument in bit operations must be set to NULL.
Data Structures | |
struct | as_bit_policy |
Enumerations | |
enum | as_bit_overflow_action { AS_BIT_OVERFLOW_FAIL = 0 , AS_BIT_OVERFLOW_SATURATE = 2 , AS_BIT_OVERFLOW_WRAP = 4 } |
enum | as_bit_resize_flags { AS_BIT_RESIZE_DEFAULT = 0 , AS_BIT_RESIZE_FROM_FRONT = 1 , AS_BIT_RESIZE_GROW_ONLY = 2 , AS_BIT_RESIZE_SHRINK_ONLY = 4 } |
enum | as_bit_write_flags { AS_BIT_WRITE_DEFAULT = 0 , AS_BIT_WRITE_CREATE_ONLY = 1 , AS_BIT_WRITE_UPDATE_ONLY = 2 , AS_BIT_WRITE_NO_FAIL = 4 , AS_BIT_WRITE_PARTIAL = 8 } |
Functions | |
static void | as_bit_policy_init (as_bit_policy *policy) |
static void | as_bit_policy_set_write_flags (as_bit_policy *policy, as_bit_write_flags flags) |
static bool | as_operations_bit_add (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size, uint64_t value, bool sign, as_bit_overflow_action action) |
static bool | as_operations_bit_and (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size, uint32_t value_byte_size, uint8_t *value) |
static bool | as_operations_bit_count (as_operations *ops, const char *name, as_cdt_ctx *ctx, int bit_offset, uint32_t bit_size) |
static bool | as_operations_bit_get (as_operations *ops, const char *name, as_cdt_ctx *ctx, int bit_offset, uint32_t bit_size) |
AS_EXTERN bool | as_operations_bit_get_int (as_operations *ops, const char *name, as_cdt_ctx *ctx, int bit_offset, uint32_t bit_size, bool sign) |
AS_EXTERN bool | as_operations_bit_insert (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int byte_offset, uint32_t value_byte_size, uint8_t *value) |
static bool | as_operations_bit_lscan (as_operations *ops, const char *name, as_cdt_ctx *ctx, int bit_offset, uint32_t bit_size, bool value) |
static bool | as_operations_bit_lshift (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size, uint32_t shift) |
static bool | as_operations_bit_not (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size) |
static bool | as_operations_bit_or (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size, uint32_t value_byte_size, uint8_t *value) |
static bool | as_operations_bit_remove (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int byte_offset, uint32_t byte_size) |
AS_EXTERN bool | as_operations_bit_resize (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, uint32_t byte_size, as_bit_resize_flags flags) |
static bool | as_operations_bit_rscan (as_operations *ops, const char *name, as_cdt_ctx *ctx, int bit_offset, uint32_t bit_size, bool value) |
static bool | as_operations_bit_rshift (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size, uint32_t shift) |
static bool | as_operations_bit_set (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size, uint32_t value_byte_size, uint8_t *value) |
AS_EXTERN bool | as_operations_bit_set_int (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size, int64_t value) |
static bool | as_operations_bit_subtract (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size, uint64_t value, bool sign, as_bit_overflow_action action) |
static bool | as_operations_bit_xor (as_operations *ops, const char *name, as_cdt_ctx *ctx, as_bit_policy *policy, int bit_offset, uint32_t bit_size, uint32_t value_byte_size, uint8_t *value) |
Action to take when bitwise add/subtract results in overflow/underflow.
Definition at line 126 of file as_bit_operations.h.
enum as_bit_resize_flags |
Bitmap resize flags.
Definition at line 99 of file as_bit_operations.h.
enum as_bit_write_flags |
Bitmap write flags.
Definition at line 64 of file as_bit_operations.h.
|
inlinestatic |
Initialize bit policy to default.
Definition at line 230 of file as_bit_operations.h.
References AS_BIT_WRITE_DEFAULT, and as_bit_policy::flags.
|
inlinestatic |
Set bit write flags in bit policy.
Definition at line 241 of file as_bit_operations.h.
References as_bit_policy::flags.
|
inlinestatic |
Create bit "add" operation. Server adds value to bitmap starting at bit_offset for bit_size. bit_size must be <= 64. Sign indicates if bits should be treated as a signed number. If add overflows/underflows, as_bit_overflow_action is used. Server does not return a value. Example:
Definition at line 500 of file as_bit_operations.h.
References as_bit_math(), and AS_BIT_OP_ADD.
|
inlinestatic |
Create bit "and" operation. Server performs bitwise "and" on value and bitmap at bit_offset for bit_size. Server does not return a value. Example:
Definition at line 402 of file as_bit_operations.h.
References as_bit_byte_math(), and AS_BIT_OP_AND.
|
inlinestatic |
Create bit "count" operation. Server returns integer count of set bits from bitmap starting at bit_offset for bit_size. Example:
Definition at line 591 of file as_bit_operations.h.
References AS_BIT_OP_COUNT, and as_bit_read().
|
inlinestatic |
Create bit "get" operation. Server returns bits from bitmap starting at bit_offset for bit_size. Example:
Definition at line 570 of file as_bit_operations.h.
References AS_BIT_OP_GET, and as_bit_read().
AS_EXTERN bool as_operations_bit_get_int | ( | as_operations * | ops, |
const char * | name, | ||
as_cdt_ctx * | ctx, | ||
int | bit_offset, | ||
uint32_t | bit_size, | ||
bool | sign ) |
Create bit "get integer" operation. Server returns integer from bitmap starting at bit_offset for bit_size. Sign indicates if bits should be treated as a signed number. Example:
AS_EXTERN bool as_operations_bit_insert | ( | as_operations * | ops, |
const char * | name, | ||
as_cdt_ctx * | ctx, | ||
as_bit_policy * | policy, | ||
int | byte_offset, | ||
uint32_t | value_byte_size, | ||
uint8_t * | value ) |
Create byte "insert" operation. Server inserts value bytes into bitmap at byte_offset. Server does not return a value. Example:
|
inlinestatic |
Create bit "left scan" operation. Server returns integer bit offset of the first specified value bit in bitmap starting at bit_offset for bit_size. Example:
Definition at line 614 of file as_bit_operations.h.
References AS_BIT_OP_LSCAN, and as_bit_scan().
|
inlinestatic |
Create bit "left shift" operation. Server shifts left bitmap starting at bit_offset for bit_size. Server does not return a value. Example:
Definition at line 449 of file as_bit_operations.h.
References AS_BIT_OP_LSHIFT, and as_bit_shift().
|
inlinestatic |
Create bit "not" operation. Server negates bitmap starting at bit_offset for bit_size. Server does not return a value. Example:
Definition at line 425 of file as_bit_operations.h.
References AS_BIT_OP_NOT, and as_bit_write().
|
inlinestatic |
Create bit "or" operation. Server performs bitwise "or" on value and bitmap at bit_offset for bit_size. Server does not return a value. Example:
Definition at line 352 of file as_bit_operations.h.
References as_bit_byte_math(), and AS_BIT_OP_OR.
|
inlinestatic |
Create byte "remove" operation. Server removes bytes from bitmap at byte_offset for byte_size. Server does not return a value. Example:
Definition at line 302 of file as_bit_operations.h.
References AS_BIT_OP_REMOVE, and as_bit_write().
AS_EXTERN bool as_operations_bit_resize | ( | as_operations * | ops, |
const char * | name, | ||
as_cdt_ctx * | ctx, | ||
as_bit_policy * | policy, | ||
uint32_t | byte_size, | ||
as_bit_resize_flags | flags ) |
Create byte "resize" operation. Server resizes bitmap to byte_size according to flags. Server does not return a value. Example:
|
inlinestatic |
Create bit "right scan" operation. Server returns integer bit offset of the last specified value bit in bitmap starting at bit_offset for bit_size. Example:
Definition at line 638 of file as_bit_operations.h.
References AS_BIT_OP_RSCAN, and as_bit_scan().
|
inlinestatic |
Create bit "right shift" operation. Server shifts right bitmap starting at bit_offset for bit_size. Server does not return a value. Example:
Definition at line 473 of file as_bit_operations.h.
References AS_BIT_OP_RSHIFT, and as_bit_shift().
|
inlinestatic |
Create bit "set" operation. Server sets value on bitmap at bit_offset for bit_size. Server does not return a value. Example:
Definition at line 327 of file as_bit_operations.h.
References as_bit_byte_math(), and AS_BIT_OP_SET.
AS_EXTERN bool as_operations_bit_set_int | ( | as_operations * | ops, |
const char * | name, | ||
as_cdt_ctx * | ctx, | ||
as_bit_policy * | policy, | ||
int | bit_offset, | ||
uint32_t | bit_size, | ||
int64_t | value ) |
Create bit "set integer" operation. Server sets value to bitmap starting at bit_offset for bit_size. Size must be <= 64. Server does not return a value. Example:
|
inlinestatic |
Create bit "subtract" operation. Server subtracts value from bitmap starting at bit_offset for bit_size. bit_size must be <= 64. Sign indicates if bits should be treated as a signed number. If add overflows/underflows, as_bit_overflow_action is used. Server does not return a value. Example:
Definition at line 527 of file as_bit_operations.h.
References as_bit_math(), and AS_BIT_OP_SUBTRACT.
|
inlinestatic |
Create bit "exclusive or" operation. Server performs bitwise "xor" on value and bitmap at bit_offset for bit_size. Server does not return a value. Example:
Definition at line 377 of file as_bit_operations.h.
References as_bit_byte_math(), and AS_BIT_OP_XOR.