BSON_VECTOR_PA...W_WRITE_PACKED(3)
π BSON_VECTOR_PA...W_WRITE_PACKED(3) β¨
okay so bestie, we're in libbson territory today and this one's literally about copying a contiguous block of packed bytes into a bson_vector_packed_bit_view_t. yeah. that's the whole vibe. stay with me π«Ά
πΈ SYNOPSIS πΈ
bool
bson_vector_packed_bit_view_write_packed (bson_vector_packed_bit_view_t view,
const uint8_t *packed_values,
size_t byte_count,
size_t vector_offset_bytes);
π PARAMETERS π
viewβ a validbson_vector_packed_bit_view_t. like, it has to be valid, no cap, don't come at this function with a cursed view πpacked_valuesβ the location where the packed bytes will be copied from. it's giving source-of-truth energy.byte_countβ how many bytes we're writing. number goes here πvector_offset_bytesβ the byte index of the first packed byte to write. i.e. where in the Vector we're dropping this stuff.
π¦ DESCRIPTION π¦
So the way this works: packed bytes get copied in bulk from that input pointer straight into the view you handed over. bulk copy. one shot. iconic behavior honestly.
Now here's the part you gotta hear π β if the Vector's element count isn't a multiple of 8, its final byte is gonna include bits that don't belong to any element. leftovers. stragglers. and this function cannot be used to modify those unused bits. not its job, not its era. those bits will be explicitly zeroed if they were set. zeroed. gone. periodt.
π RETURNS π
If byte_count and vector_offset_bytes overflow the bounds of the Vector, it returns false and does literally nothing else β no partial writes, no sneaky side effects, just false and out π.
If the parameters are in range though? it's guaranteed to succeed. guaranteed, bestie. on success it returns true and writes byte_count bytes from *packed_values into the Vector starting at byte index vector_offset_bytes. slay π
β SEE ALSO β
bson_vector_packed_bit_view_read_packed()bson_vector_packed_bit_const_view_read_packed()
(the read girlies, iykyk π§)
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
k bye bestie, go copy some bytes responsibly π
libbson Β· version 2.5.6 Β· dated Oct 09, 202 (yeah the date got cut off in the header line, not me, blame the typesetter π) β mwah, see u in the next page πβ¨
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms