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

cpp: Add support for _uint256be literals #596

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

Conversation

axic
Copy link
Member

@axic axic commented May 4, 2021

Only extending the literal tests, because the other tests are covered
via bytes32 tests given uint256be is an alias.

@codecov
Copy link

codecov bot commented May 4, 2021

Codecov Report

Merging #596 (dcdfb9f) into master (58913e0) will increase coverage by 0.96%.
The diff coverage is 100.00%.

❗ Current head dcdfb9f differs from pull request most recent head 57b3cc3. Consider uploading reports for the commit 57b3cc3 to get more accurate results

@@            Coverage Diff             @@
##           master     #596      +/-   ##
==========================================
+ Coverage   92.84%   93.81%   +0.96%     
==========================================
  Files          23       25       +2     
  Lines        3552     3769     +217     
  Branches      376        0     -376     
==========================================
+ Hits         3298     3536     +238     
- Misses        144      233      +89     
+ Partials      110        0     -110     

@axic axic requested a review from chfast May 4, 2021 22:57
Copy link
Member

@chfast chfast left a comment

Choose a reason for hiding this comment

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

Are you going to use it?

@chfast
Copy link
Member

chfast commented May 5, 2021

What will be confusing here is that these literals are required to have exactly 64 hex digits.

@axic
Copy link
Member Author

axic commented May 5, 2021

Are you going to use it?

I was adding --value support to the evmc tool, that's how I found this, but in the end it is actually not that important.

What will be confusing here is that these literals are required to have exactly 64 hex digits.

Yeah I was wondering if it would make sense make this work on decimal instead. Probably better holding the merge back a bit.

@chfast
Copy link
Member

chfast commented May 6, 2021

Yeah I was wondering if it would make sense make this work on decimal instead. Probably better holding the merge back a bit.

Unless there exist some simplified algorithm for decimal literals I'm not aware of, this requires implementing multiplication by 10. https://github.com/chfast/intx/blob/master/include/intx/int128.hpp#L893

@axic axic changed the title cpp: Add support for _uin256be literals cpp: Add support for _uint256be literals May 22, 2022
@axic
Copy link
Member Author

axic commented May 22, 2022

@chfast leaning towards that even with base 16 this may be useful

Only extending the literal tests, because the other tests are covered
via bytes32 tests given uint256be is an alias.
@axic
Copy link
Member Author

axic commented Jun 1, 2022

Rebased. I think this is still useful for unit tests, based on ethereum/tests. I think I needed/wanted it for soltests at the time.

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