Supress unsigned-integer-overflow for PaddingBytes ()

This commit is contained in:
Björn Harrtell 2019-12-09 19:06:04 +01:00 committed by Wouter van Oortmerssen
parent a8e800bd7c
commit b20801ca40
1 changed files with 1 additions and 0 deletions
include/flatbuffers

View File

@ -382,6 +382,7 @@ template<typename T> __supress_ubsan__("alignment") void WriteScalar(void *p, Of
// Computes how many bytes you'd have to pad to be able to write an
// "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in
// memory).
__supress_ubsan__("unsigned-integer-overflow")
inline size_t PaddingBytes(size_t buf_size, size_t scalar_size) {
return ((~buf_size) + 1) & (scalar_size - 1);
}