Zserio C++ runtime library  1.0.2
Built for Zserio 2.14.1
BitPositionUtil.h
Go to the documentation of this file.
1 #ifndef ZSERIO_BITPOSITION_UTIL_H_INC
2 #define ZSERIO_BITPOSITION_UTIL_H_INC
3 
4 #include <cstddef>
5 
6 namespace zserio
7 {
8 
17 inline size_t alignTo(size_t alignmentValue, size_t bitPosition)
18 {
19  return (bitPosition > 0 && alignmentValue != 0)
20  ? (((bitPosition - 1) / alignmentValue) + 1) * alignmentValue
21  : bitPosition;
22 }
23 
24 } // namespace zserio
25 
26 #endif // ifndef ZSERIO_BITPOSITION_UTIL_H_INC
size_t alignTo(size_t alignmentValue, size_t bitPosition)