Debian Codegraph @

mlspp/lib/hpke/src/common.cpp

raw symbols SCIP
1 #include "common.h"
2
3 namespace mlspp::hpke {
4
5 bytes
6 i2osp(uint64_t val, size_t size)
7 {
8 auto out = bytes(size, 0);
9 auto max = size;
10 if (size > 8) {
11 max = 8;
12 }
13
14 for (size_t i = 0; i < max; i++) {
15 out.at(size - i - 1) = static_cast<uint8_t>(val >> (8 * i));
16 }
17 return out;
18 }
19
20 } // namespace mlspp::hpke