in pir.cpp [121:151]
vector<uint64_t> bytes_to_coeffs(uint32_t limit, const uint8_t *bytes, uint64_t size) {
uint64_t size_out = coefficients_per_element(limit, size);
vector<uint64_t> output(size_out);
uint32_t room = limit;
uint64_t *target = &output[0];
for (uint32_t i = 0; i < size; i++) {
uint8_t src = bytes[i];
uint32_t rest = 8;
while (rest) {
if (room == 0) {
target++;
room = limit;
}
uint32_t shift = rest;
if (room < rest) {
shift = room;
}
*target = *target << shift;
*target = *target | (src >> (8 - shift));
src = src << shift;
room -= shift;
rest -= shift;
}
}
*target = *target << room;
return output;
}