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

Build a helper for "binary string formatting" #4538

Open
reneme opened this issue Jan 10, 2025 · 0 comments
Open

Build a helper for "binary string formatting" #4538

reneme opened this issue Jan 10, 2025 · 0 comments

Comments

@reneme
Copy link
Collaborator

reneme commented Jan 10, 2025

I think what I want for things like this is some kind of "binary format string" eg

const auto prefix = format_binary("%u16be %u8bytes %u8", length, label, hash_val);

(not exactly this, those format string choices suck and are just for exposition; there is probably a lot of prior art here)

As of recently, we have the internal concat() helper for this which should already do such "binary string operations" as efficiently as possible. But the resulting code is often verbose (with multiple type conversions) and hard to understand.

Originally posted by @randombit in #4455 (comment)

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

No branches or pull requests

1 participant