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

intx: Add as_bytes() helper for casting intx to bytes #106

Merged
merged 1 commit into from
Aug 14, 2019
Merged

Conversation

chfast
Copy link
Owner

@chfast chfast commented Aug 14, 2019

No description provided.

@codecov-io
Copy link

Codecov Report

Merging #106 into master will decrease coverage by 3.43%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #106      +/-   ##
==========================================
- Coverage   70.42%   66.98%   -3.44%     
==========================================
  Files           8        8              
  Lines        1349     1360      +11     
  Branches      157      158       +1     
==========================================
- Hits          950      911      -39     
- Misses        351      401      +50     
  Partials       48       48

@chfast chfast merged commit 9312a4c into master Aug 14, 2019
@chfast chfast deleted the as_bytes branch August 14, 2019 21:40
const auto b = as_bytes(x);
EXPECT_EQ(b[0], 5);
EXPECT_EQ(b[1], 0xa);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This codifies it as little endian. Should this be implemented for both be/le ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I have to add big endian support in general. But not a priority in the moment. I only have time to add features needed in other EVM projects.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well EVM is big endian, isn't it?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Correct, but this API is needed for intx::be API and in one place in evmone. It exposes internal representation as bytes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So perhaps can you move as_bytes into intx::be ?

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.

3 participants