BSON_VECTOR_IN...ARY_DATA_LENGTH(3)

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

πŸ’– BSON_VECTOR_IN...ARY_DATA_LENGTH(3) πŸ’–

okay bestie, this is a libbson page, and it's literally about calculating the size of a BSON Binary field that would be needed to store a Vector with the indicated number of int8 elements. no cap, that's the whole assignment. ✨

✨ SYNOPSIS ✨

uint32_t
bson_vector_int8_binary_data_length (size_t element_count);

πŸŽ€ PARAMETERS πŸŽ€

  • element_count β€” Number of elements, as a size_t. that's the input, bestie 🫢

πŸ’… DESCRIPTION πŸ’…

So what it does: it checks element_count against the maximum representable size, and then calculates the required Binary size. lowkey essential math, highkey slay. 🧚

🌸 RETURNS 🌸

On success, it returns the required Binary size as a uint32_t greater than or equal to BSON_VECTOR_HEADER_LEN. This length includes the 2-byte Vector header, but not the Binary subtype header or any other BSON headers.

If element_count is too large to represent, it returns 0. so yeah, zero is the β€œnope, too big” signal here. πŸ’€

🫢 AUTHOR 🫢

MongoDB, Inc 🫢

2009-present, MongoDB, Inc. πŸ‘‘


xoxo, this is libbson version 2.5.6, dated Oct 09, 20… β€” and that's the tea πŸ“πŸ’‹βœ¨

πŸ“¦ where this page comes from