-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add crc helpers for writing to large buffers. #93
Conversation
#include <limits.h> | ||
|
||
#define large_buffer_apply_impl(Name, T) \ | ||
T aws_large_buffer_apply_##Name( \ |
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.
T aws_large_buffer_apply_##Name( \ | |
static T aws_large_buffer_apply_##Name( \ |
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.
Or don't declare a separate function here, just have it be the implementation like:
#define CHECKSUM_WITH_SIZE_IMPL(Name, T) \
... \
return val
and then
uint32_t aws_checksums_crc32_with_size(const uint8_t *input, size_t length, uint32_t previous_crc32) {
CHECKSUM_WITH_SIZE_IMPL(aws_checksums_crc32, uint32_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.
i prefer to keep a separate function here, mostly to sanity check that function pointer prototype has args that match the other args passed to this function.
Issue #, if available:
Description of changes:
we defined all crc functions to take int for length and then in every binding we have code to work around buffers that are more than INT_MAX.
This just add same helper here so we can skip repeating it in every binding.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.