Skip to content

fix another potential source of undefined behavior#283

Merged
mdadams merged 2 commits intojasper-software:masterfrom
alex:patch-1
Mar 18, 2021
Merged

fix another potential source of undefined behavior#283
mdadams merged 2 commits intojasper-software:masterfrom
alex:patch-1

Conversation

@alex
Copy link
Copy Markdown
Contributor

@alex alex commented Mar 14, 2021

if prec is 31, this leads to an undefined shift

if prec is 31, this leads to an undefined shift
Copy link
Copy Markdown
Member

@jubalh jubalh left a comment

Choose a reason for hiding this comment

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

What about int prec ?

@jubalh jubalh requested a review from mdadams March 18, 2021 12:28
@mdadams
Copy link
Copy Markdown
Collaborator

mdadams commented Mar 18, 2021

if prec is 31, this leads to an undefined shift

@alex Please change the "1U" to "JAS_CAST(uint_fast32_t, 1)" and I can merge this PR. Since the result is effectively being computed in uint_fast32_t (not unsigned), I think that this would be slightly better.

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.

3 participants