-
Notifications
You must be signed in to change notification settings - Fork 43
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
Encode size_t types with fixed-length + extended generated tests #44
Conversation
// encode size_t as fixed 4-bytes integer | ||
template <options O, typename T, typename U> | ||
typename std::enable_if< | ||
std::is_same_v<U, std::size_t>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be just size_t
instead of std::size_t
? To be consistent with the rest of your code in from_bytes.h
include/alpaca/detail/to_bytes.h
Outdated
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these new lines?
Found additional issues, need to rethink on that. |
This PR addresses issue #43 by serializing size_t integers (when fixed-length encoding is enabled) using a fixed and configurable number of bytes (32 or 64).
The current implementation is not architecture-agnostic.
The type used for size_t serialization can be configured in include/alpaca/detail/from_bytes.h by changing the using size_t_serialized_type = uint64_t; definition.
I also added a set of end-to-end tests (serialize + deserialize in the same test) generated by Chat-GPT.