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

Fixed conversion of large uint/ulong/long hex literals #1152

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gaschd
Copy link

@gaschd gaschd commented Nov 4, 2024

Problem

#1147

Hex literals of numeric types uint, ulong and long with larger values than int.MaxValue failed to convert as there was a special case for int hex literals, where the numeric value is parsed to an int causing a wrong conversion.

Solution

Restricting this special case (8 digit hex literal) to values of type int only.

#1115 resolved issue #1064 for integer values but long hex literals (16 digit hex literal) seem to have the same issue:

0xFFFFFFFFFFFFFFFEL is interpreted as uint64 instead of int64.

So this PR also applies the same solution to convert

Private Const LargeLong As Long = &HFFFFFFFFFFFFFFFEL
to
private const long LargeLong = unchecked((long)0xFFFFFFFFFFFFFFFE);

@gaschd gaschd changed the title Fixed conversionof for large uint/ulong and long Fixed conversion of large uint/ulong/long hex literals Nov 4, 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.

1 participant