@@ -1250,9 +1250,11 @@ class Roaring64Map {
12501250 }
12511251
12521252 /* *
1253- * For advanced users only.
1253+ * For advanced users only. This function is unsafe. You must ensure that
1254+ * the provided buffer is 32-byte aligned.
12541255 */
12551256 static const Roaring64Map frozenView (const char *buf) {
1257+ // We do not check that buf is 32-byte aligned. Caller is responsible.
12561258 // size of bitmap buffer and key
12571259 const size_t metadata_size = sizeof (size_t ) + sizeof (uint32_t );
12581260
@@ -1311,16 +1313,24 @@ class Roaring64Map {
13111313 return result;
13121314 }
13131315
1316+ /* *
1317+ * For advanced users only. Offered on a best-effort basis.
1318+ * If you use this function in production, you are responsible for
1319+ * testing it on your target platforms. This function is unsafe.
1320+ */
13141321 // As with serialized 64-bit bitmaps, 64-bit frozen bitmaps are serialized
13151322 // by concatenating one or more Roaring::write output buffers with the
1316- // preceeding map key. Unlike standard bitmap serialization, frozen bitmaps
1317- // must be 32-byte aligned and requires a buffer length to parse. As a
1318- // result, each concatenated output of Roaring::writeFrozen is preceeded by
1319- // padding, the buffer size (size_t), and the map key (uint32_t). The
1320- // padding is used to ensure 32-byte alignment, but since it is followed by
1321- // the buffer size and map key, it actually pads to `(x - sizeof(size_t) +
1322- // sizeof(uint32_t)) mod 32` to leave room for the metadata.
1323+ // preceeding map key. Like the 32-bit bitmaps, it expects that the provided
1324+ // buffer is 32-byte aligned. The caller is responsible to check the
1325+ // alignment. Unlike standard bitmap serialization, frozen bitmaps must be
1326+ // 32-byte aligned and requires a buffer length to parse. As a result, each
1327+ // concatenated output of Roaring::writeFrozen is preceeded by padding, the
1328+ // buffer size (size_t), and the map key (uint32_t). The padding is used to
1329+ // ensure 32-byte alignment, but since it is followed by the buffer size and
1330+ // map key, it actually pads to `(x - sizeof(size_t) + sizeof(uint32_t)) mod
1331+ // 32` to leave room for the metadata.
13231332 void writeFrozen (char *buf) const {
1333+ // We do not check that buf is 32-byte aligned. Caller is responsible.
13241334 // size of bitmap buffer and key
13251335 const size_t metadata_size = sizeof (size_t ) + sizeof (uint32_t );
13261336
@@ -1349,6 +1359,9 @@ class Roaring64Map {
13491359 }
13501360 }
13511361
1362+ /* *
1363+ * For advanced users only. This function is unsafe.
1364+ */
13521365 size_t getFrozenSizeInBytes () const {
13531366 // size of bitmap size and map key
13541367 const size_t metadata_size = sizeof (size_t ) + sizeof (uint32_t );
0 commit comments