Zserio C++17 runtime library  0.5.0
Built for Zserio 2.17.0
Bytes.cpp
Go to the documentation of this file.
1 #include "zserio/Bytes.h"
3 #include "zserio/Types.h"
4 
5 namespace zserio
6 {
7 
8 namespace detail
9 {
10 
11 void validate(BytesView, std::string_view)
12 {
13  // always validate
14 }
15 
16 BitSize bitSizeOf(BytesView bytesValue, BitSize)
17 {
18  const VarSize bytesSize = fromCheckedValue<VarSize>(convertSizeToUInt32(bytesValue.size()));
19 
20  // the bytes consists of varsize for size followed by the bytes
21  return bitSizeOf(bytesSize) + bytesSize * 8;
22 }
23 
24 BitSize initializeOffsets(BytesView bytesValue, BitSize bitPosition)
25 {
26  return bitSizeOf(bytesValue, bitPosition);
27 }
28 
29 } // namespace detail
30 
31 } // namespace zserio
Span< const uint8_t > BytesView
Definition: Bytes.h:30
unsigned int BitSize
Definition: BitSize.h:8
uint32_t convertSizeToUInt32(size_t value)
detail::VarIntWrapper< uint32_t, detail::VarIntType::VARSIZE > VarSize
Definition: Types.h:890