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

Support for EVM pieces #192

Closed
Tracked by #177
larryk85 opened this issue Jun 8, 2023 · 8 comments
Closed
Tracked by #177

Support for EVM pieces #192

larryk85 opened this issue Jun 8, 2023 · 8 comments
Labels
enhancement New feature or request triage

Comments

@larryk85
Copy link
Contributor

larryk85 commented Jun 8, 2023

For EOS-EVM, it has been highlighted that having the following data types and functions would be beneficial.

uint128, uint256, efficient to and from hex functions, others may be added in the next few days.

@mikelik
Copy link
Member

mikelik commented Jun 14, 2023

Currently uint128 is available in CDT as:
typedef unsigned __int128 uint128_t;

The task would be to write new uint128_t and benchmark it against existing __int128 and uint128 from https://github.com/chfast/intx/blob/master/include/intx/intx.hpp.

As for uint256 it is currently unavailable in CDT, so it has to be created and benchmarked.

Optionally benchmarked might be wide integers from boost multiprecision or https://github.com/abseil/abseil-cpp/blob/master/absl/numeric/int128.h

@mikelik
Copy link
Member

mikelik commented Jun 14, 2023

Benchmark of uint128:
abseil vs GCC's builtin vs intx vs boost

https://github.com/mikelik/int128-benchmark

@mikelik mikelik mentioned this issue Jun 16, 2023
2 tasks
@mikelik
Copy link
Member

mikelik commented Jun 16, 2023

Decision is to go with _BitInt(128) and _BitInt(256) which are supported by clang-16. BitInt is part of C23 standard.

@mikelik
Copy link
Member

mikelik commented Jun 19, 2023

wide int to/from hex functions benchmark: https://github.com/mikelik/int128-benchmark/blob/main/hex.cpp

@mikelik
Copy link
Member

mikelik commented Jun 21, 2023

https://github.com/mikelik/int128-benchmark
Added benchmark hex conversion. Added new functions with improved performance by 30%

Following hex conversion functions has been chosen as fastest:
https://github.com/AntelopeIO/cdt/blob/mikelik/bitint/libraries/eosiolib/core/eosio/hex_conversion.hpp

@mikelik
Copy link
Member

mikelik commented Jun 21, 2023

This is blocked by #185

@mikelik
Copy link
Member

mikelik commented Jun 21, 2023

If someone picks this issue up they can start off from branch: https://github.com/AntelopeIO/cdt/tree/mikelik/bitint

@ericpassmore
Copy link
Contributor

no longer a performance blocker, will re-open later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage
Projects
Archived in project
Development

No branches or pull requests

5 participants