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

FIX a bug: integer type resolution #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MustBastani
Copy link

Hi,

I noticed a bug in the integer type resolver when determining the bit width of signed integers.

For example, for a range like -140..=-44, it assigns 8 bits, even though an i8 can only store values in the range -128..=127.

The problematic line is primarily in:

std::cmp::max(bits_needed_min, bits_needed_max) + if min < 0 && max > 0 { 1 } else { 0 }

However, my pull request includes additional changes to address the various integer bit widths.

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.

1 participant