BSON_VECTOR_PA...W_WRITE_PACKED(3)

πŸ“¦
version 2.5.6 Β· 3 versions
, in epel 10

πŸ’… 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 valid bson_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


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