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

Ensure UIntX length #2655

Merged
merged 2 commits into from
Jan 28, 2022
Merged

Ensure UIntX length #2655

merged 2 commits into from
Jan 28, 2022

Conversation

shargon
Copy link
Member

@shargon shargon commented Jan 26, 2022

Close #2654

@Jim8y
Copy link
Contributor

Jim8y commented Jan 26, 2022

Does this mean that I can not convert 0x0306 into an UInt160 and UInt256?

@shargon
Copy link
Member Author

shargon commented Jan 26, 2022

Does this mean that I can not convert 0x0306 into an UInt160 and UInt256?

Yes, you can't

@Jim8y
Copy link
Contributor

Jim8y commented Jan 26, 2022

Yes, you can't

This is wired, imaging we can not assign int 3 to long.

I can understand that you may not wish to assign a longer value to a shorter type, but I could not understand why you not even allow assigning a short value to a longer type.

C# allows this:

            int a = 5;
            long b = a;

But if you think it is right to do so, I am ok with that.

@roman-khimov
Copy link
Contributor

These "uints" are not really integers (#938 (comment) also), so I see no issue there.

@Jim8y
Copy link
Contributor

Jim8y commented Jan 26, 2022

These "uints" are not really integers (#938 (comment) also), so I see no issue there.

Thank you. Now I see.

@shargon shargon merged commit 1e44918 into neo-project:master Jan 28, 2022
@shargon shargon deleted the assert-size branch January 28, 2022 10:07
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.

UInt160 can be instantiated with ReadOnlySpan<byte> of inappropriate size
4 participants