bits2gbuffer()

bits2gbuffer()#

Converts a bitmask into a gbuffer_t structure containing a string representation of the set bits, separated by ‘|’.

Prototype

gbuffer_t *bits2gbuffer(
    const char **strings_table,
    uint64_t bits
);

Parameters

Key

Type

Description

strings_table

const char **

An array of strings representing bit names, terminated by a NULL pointer.

bits

uint64_t

A bitmask where each set bit corresponds to an index in strings_table.


Return Value

A newly allocated gbuffer_t * containing the string representation of the set bits, or NULL if memory allocation fails.

Notes

The caller is responsible for managing the memory of the returned gbuffer_t * using gbuffer_decref().

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples