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

Implement specialization fast path for mixed types operations #51

Open
mratsim opened this issue May 31, 2018 · 1 comment
Open

Implement specialization fast path for mixed types operations #51

mratsim opened this issue May 31, 2018 · 1 comment

Comments

@mratsim
Copy link
Contributor

mratsim commented May 31, 2018

#49 and #50 will introduce overloaded proc to allow the following

  • uint256 + uint64
  • uint64 + uint256
  • ...

Currently those will be implemented by converting the smaller int to uint256, meaning extra zero allocation.

As mentioned here, a fast (?) path can be use which avoids this allocation. It requires special casing/reimplementing most of the procs however to handle:

  • carry in addition
  • borrow in substraction
  • carry in multiplication
  • Division/mod I'm not sure, I don't think we can specialize, we need to shift the most significant bit of the divisor to the MSB of the dividend to do fast division.
  • xor/or/and special iterator (or do result = input64.u256 and then result = result xor input256)
@zah
Copy link
Contributor

zah commented May 31, 2018

Just a probably obvious tip: For +, *, xor/and/or, you can implement only one of those operations and remap the other variant with a template.

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

No branches or pull requests

2 participants