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

Encode size_t types with fixed-length + extended generated tests #44

Closed
wants to merge 3 commits into from

Conversation

lrodorigo
Copy link

@lrodorigo lrodorigo commented Jun 5, 2024

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.

// 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>,
Copy link
Owner

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

Comment on lines 106 to 124



















Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these new lines?

@lrodorigo
Copy link
Author

Found additional issues, need to rethink on that.

@lrodorigo lrodorigo closed this Jun 6, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants