bitstring.c
Include dependency graph for bitstring.c:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"5" [label="stdbool.h" tooltip="stdbool.h"]
"18" [label="refc_binary.h" tooltip="refc_binary.h"]
"13" [label="assert.h" tooltip="assert.h"]
"16" [label="utils.h" tooltip="utils.h"]
"19" [label="list.h" tooltip="list.h"]
"6" [label="stdint.h" tooltip="stdint.h"]
"8" [label="stdlib.h" tooltip="stdlib.h"]
"10" [label="memory.h" tooltip="memory.h"]
"20" [label="resources.h" tooltip="resources.h"]
"3" [label="term.h" tooltip="term.h"]
"17" [label="stddef.h" tooltip="stddef.h"]
"11" [label="erl_nif.h" tooltip="erl_nif.h"]
"14" [label="limits.h" tooltip="limits.h"]
"4" [label="sys/types.h" tooltip="sys/types.h"]
"9" [label="string.h" tooltip="string.h"]
"12" [label="term_typedef.h" tooltip="term_typedef.h"]
"1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c" fillcolor="#BFBFBF"]
"2" [label="bitstring.h" tooltip="bitstring.h"]
"22" [label="math.h" tooltip="math.h"]
"21" [label="unicode.h" tooltip="unicode.h"]
"7" [label="stdio.h" tooltip="stdio.h"]
"15" [label="inttypes.h" tooltip="inttypes.h"]
"18" -> "5" [dir=forward tooltip="include"]
"18" -> "8" [dir=forward tooltip="include"]
"18" -> "19" [dir=forward tooltip="include"]
"18" -> "20" [dir=forward tooltip="include"]
"16" -> "17" [dir=forward tooltip="include"]
"16" -> "7" [dir=forward tooltip="include"]
"16" -> "8" [dir=forward tooltip="include"]
"19" -> "5" [dir=forward tooltip="include"]
"10" -> "6" [dir=forward tooltip="include"]
"10" -> "8" [dir=forward tooltip="include"]
"10" -> "11" [dir=forward tooltip="include"]
"10" -> "12" [dir=forward tooltip="include"]
"10" -> "16" [dir=forward tooltip="include"]
"20" -> "8" [dir=forward tooltip="include"]
"20" -> "11" [dir=forward tooltip="include"]
"20" -> "19" [dir=forward tooltip="include"]
"20" -> "10" [dir=forward tooltip="include"]
"3" -> "4" [dir=forward tooltip="include"]
"3" -> "5" [dir=forward tooltip="include"]
"3" -> "6" [dir=forward tooltip="include"]
"3" -> "7" [dir=forward tooltip="include"]
"3" -> "8" [dir=forward tooltip="include"]
"3" -> "9" [dir=forward tooltip="include"]
"3" -> "10" [dir=forward tooltip="include"]
"3" -> "18" [dir=forward tooltip="include"]
"3" -> "16" [dir=forward tooltip="include"]
"3" -> "12" [dir=forward tooltip="include"]
"11" -> "12" [dir=forward tooltip="include"]
"12" -> "13" [dir=forward tooltip="include"]
"12" -> "14" [dir=forward tooltip="include"]
"12" -> "15" [dir=forward tooltip="include"]
"12" -> "6" [dir=forward tooltip="include"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "13" [dir=forward tooltip="include"]
"1" -> "22" [dir=forward tooltip="include"]
"2" -> "3" [dir=forward tooltip="include"]
"2" -> "21" [dir=forward tooltip="include"]
"2" -> "5" [dir=forward tooltip="include"]
"2" -> "6" [dir=forward tooltip="include"]
"21" -> "5" [dir=forward tooltip="include"]
"21" -> "17" [dir=forward tooltip="include"]
"21" -> "6" [dir=forward tooltip="include"]
}](../../../_images/graphviz-5c4662e61bdb68aec44dfa1a52f2900e208f356b.png)
Functions
-
static inline uint64_t from_le64(uint64_t value)
-
bool bitstring_extract_any_integer(const uint8_t *src, size_t offset, avm_int_t n, enum BitstringFlags bs_flags, union maybe_unsigned_int64 *dst)
-
bool bitstring_insert_any_integer(uint8_t *dst, avm_int_t offset, avm_int64_t value, size_t n, enum BitstringFlags bs_flags)
-
static bool is_invalid_codepoint(int32_t v)
-
bool bitstring_utf8_encode(uint32_t c, uint8_t *buf, size_t *out_size)
Encode a character to UTF-8.
- Parameters:
c – character to encode
buf – the buffer to encode the sring to or NULL to only compute the size.
out_size – the size in bytes, on output (if not NULL)
- Returns:
true
if encoding was successful,false
if c is not a valid unicode character
-
bool bitstring_utf16_encode(uint32_t c, uint8_t *buf, enum BitstringFlags bs_flags, size_t *out_size)
Encode a character to UTF-16.
- Parameters:
c – character to encode
buf – the buffer to encode the character to or NULL to only compute the size.
bs_flags – flags to encode the character (undefined/little/big/native)
out_size – the size in bytes, on output (if not NULL)
- Returns:
true
if encoding was successful,false
if c is not a valid unicode character
-
bool bitstring_utf16_decode(const uint8_t *buf, size_t len, int32_t *c, size_t *out_size, enum BitstringFlags bs_flags)
Decode a character from UTF-16.
- Parameters:
c – int value to decode to
buf – the buffer froom which to decode the sring to or NULL to only compute the size.
len – the length (in bytes) of the bytes in buf
bs_flags – flags to decode the character (undefined/little/big/native)
out_size – the size in bytes, on output (if not NULL)
- Returns:
true
if decoding was successful,false
if character starting at buf is not a valid unicode character
-
bool bitstring_utf32_encode(uint32_t c, uint8_t *buf, enum BitstringFlags bs_flags)
Encode a character to UTF-32.
- Parameters:
c – character to encode
buf – the buffer to encode the character
bs_flags – flags to encode the character (undefined/little/big/native)
- Returns:
true
if encoding was successful,false
if c is not a valid unicode character
-
bool bitstring_utf32_decode(const uint8_t *buf, size_t len, int32_t *c, enum BitstringFlags bs_flags)
Decode a character from UTF-32.
- Parameters:
c – int value to decode to
buf – the buffer froom which to decode the sring to or NULL to only compute the size.
len – the length (in bytes) of the bytes in buf
bs_flags – flags to decode the character (undefined/little/big/native)
- Returns:
true
if decoding was successful,false
if character starting at buf is not a valid unicode character
-
void bitstring_copy_bits_incomplete_bytes(uint8_t *dst, size_t bits_offset, const uint8_t *src, size_t bits_count)
Copy bits_count bits from src to dst[bits_offset..].
Called by bitstring_copy_bits when bytes are not complete.
- Parameters:
dst – destination buffer
bits_offset – offset in bits in destination buffer
src – source buffer
bits_count – number of bits
-
bool bitstring_extract_f32(term src_bin, size_t offset, avm_int_t n, enum BitstringFlags bs_flags, avm_float_t *dst)
-
bool bitstring_extract_f64(term src_bin, size_t offset, avm_int_t n, enum BitstringFlags bs_flags, avm_float_t *dst)