mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-03 20:34:13 +00:00
Adds ForceStringAlignment to flatbuffers. (#4828)
ForceStringAlignment is useful for memory aligning string fields in flatbuffers.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
88cd182349
commit
4235a25640
@@ -1207,6 +1207,11 @@ class FlatBufferBuilder {
|
|||||||
PreAlign(len * elemsize, alignment);
|
PreAlign(len * elemsize, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Similar to ForceVectorAlignment but for String fields.
|
||||||
|
void ForceStringAlignment(size_t len, size_t alignment) {
|
||||||
|
PreAlign((len + 1) * sizeof(char), alignment);
|
||||||
|
}
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
/// @brief Serialize an array into a FlatBuffer `vector`.
|
/// @brief Serialize an array into a FlatBuffer `vector`.
|
||||||
|
|||||||
Reference in New Issue
Block a user