-
Notifications
You must be signed in to change notification settings - Fork 1
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
Remove bitvector lib #1
base: christoph/feat/opcodes
Are you sure you want to change the base?
Remove bitvector lib #1
Conversation
eth/vm/logic/arithmetic.py
Outdated
else: | ||
result = bit_vector.shift_left(shift_length).int_val() | ||
result = (value * 2**shift_length) & constants.UINT_256_MAX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick test shows that replacing this with (value << shift_length) & constants.UINT_256_MAX
passes all the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! I have to read up on that magic!
eth/vm/logic/arithmetic.py
Outdated
else: | ||
result = bit_vector.shift_right(shift_length).int_val() | ||
result = (value // 2**shift_length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one errored out when I changed it to value >> shift_length
with an overflow error saying the integer is too large to convert to the c_type, probably something that could be worked around if we're clever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works with the same trick (value >> shift_length) & constants.UINT_256_MAX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
viola! huzzah for simple solutions
9614afb
to
888f496
Compare
What was wrong?
Un-necessary new library.
How was it fixed?
Figured out how to do it without the library.
Cute Animal Picture