bits2jn_strlist()

bits2jn_strlist()#

Converts a bitmask into a JSON list of corresponding string representations based on a provided lookup table.

Prototype

json_t *bits2jn_strlist(
    const char **strings_table,
    uint64_t bits
);

Parameters

Key

Type

Description

strings_table

const char **

An array of string literals representing bit positions, terminated by a NULL pointer.

bits

uint64_t

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


Return Value

A JSON array containing the string representations of the set bits in bits. The caller is responsible for managing the returned JSON object.

Notes

The function iterates through the strings_table and checks each bit in bits. If a bit is set, the corresponding string is added to the JSON array.

Prototype

// Not applicable in JS

Prototype

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