Skip to content

Conversation

tveasey
Copy link
Contributor

@tveasey tveasey commented Jun 24, 2020

We need to be defensive against the case that we've been asked to floor to a multiple of 0. We shouldn't be calling the function in this way at present, but it is a candidate for #1348. In this case it is natural to return the supplied integer value and certainly better than aborting.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

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

LGTM

For consistency it might also be worth changing line 43 in the aligned function to:

return alignment == static_cast<INT_TYPE>(0) || (value % alignment) == static_cast<INT_TYPE>(0);

@tveasey tveasey merged commit 9009366 into elastic:master Jun 25, 2020
@tveasey tveasey deleted the integer-floor-defensive branch June 25, 2020 08:39
tveasey added a commit to tveasey/ml-cpp-1 that referenced this pull request Jun 25, 2020
tveasey added a commit to tveasey/ml-cpp-1 that referenced this pull request Jun 25, 2020
tveasey added a commit to tveasey/ml-cpp-1 that referenced this pull request Jun 25, 2020
tveasey added a commit that referenced this pull request Jun 25, 2020
tveasey added a commit that referenced this pull request Jun 25, 2020
tveasey added a commit that referenced this pull request Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants