Skip to content

avoid undefined behavior signed int overflow#318

Merged
blueloveTH merged 1 commit intopocketpy:mainfrom
trim21:ub
Dec 25, 2024
Merged

avoid undefined behavior signed int overflow#318
blueloveTH merged 1 commit intopocketpy:mainfrom
trim21:ub

Conversation

@trim21
Copy link
Contributor

@trim21 trim21 commented Dec 24, 2024

On windows debug build runtime will check sighed overflow and popup a window

image

@blueloveTH
Copy link
Collaborator

blueloveTH commented Dec 25, 2024

I used to use your fixed version. However, I think (int8_t)val == val is faster because it requires less comparions.

We assert little endian. So I expect a "reinterpret".

@trim21
Copy link
Contributor Author

trim21 commented Dec 25, 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.

2 participants