botan
botan copied to clipboard
Internal: load_be/le should accept a BufferSlicer
Additional context here: https://github.com/randombit/botan/pull/3716#discussion_r1584989832
TL;DR: Reduce the boiler-plate when loading integers of a statically known bitlength from a buffer:
// currently
auto a = load_be<uint32_t>(slicer.take<4>());
auto b = load_be<SomeStrongIntegerType>(slicer.take<sizeof(SomeStrongIntegerType)>());
// then
auto a = load_be<uint32_t>(slicer);
auto b = load_be<SomeStrongIntegerType>(slicer);
Note that the BufferSlicer is currently part of stl_util.h which we may or may not want to include in loadstor.h. Perhaps it makes sense to move the BufferSlicer, BufferStuffer and concat() into their own dedicated header.