Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal: load_be/le should accept a BufferSlicer #4068

Open
reneme opened this issue May 22, 2024 · 0 comments
Open

Internal: load_be/le should accept a BufferSlicer #4068

reneme opened this issue May 22, 2024 · 0 comments
Assignees
Labels
enhancement Enhancement or new feature

Comments

@reneme
Copy link
Collaborator

reneme commented May 22, 2024

Additional context here: #3716 (comment)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or new feature
Projects
None yet
Development

No branches or pull requests

1 participant