intx icon indicating copy to clipboard operation
intx copied to clipboard

Implement int128 type

Open chfast opened this issue 5 years ago • 3 comments

Implement the signed variant of 128-bit integer as an adapter/wrapper of uint128 from int128.hpp.

chfast avatar Oct 02 '19 10:10 chfast

Hi @chfast, I would like to work on this. Is there any specific point I must begin from, apart from the int128.hpp file ? Also, I found these two sample code implementations, 1> https://stackoverflow.com/a/741371 2> http://codef00.com/code/uint128.h [this uses the boost library] and both of them implement the library using a similar implementation style to yours. So, I was hoping if you could shed some light on how the libary is implemented, especially the lo & hi thing. Thanks !

anuchak avatar Oct 03 '19 22:10 anuchak

Hi @anuchak,

Please note that the uint128 type is already implemented. We want to use this type to implement int128 because many operations are binary equivalent: add, mul, sub, or, xor, and, etc.

You can start by defining it like

struct int128 : private uint128 {}

And then add a constructor from int64_t.

chfast avatar Oct 04 '19 06:10 chfast

Has any progress? int128 type is useful.

Eragon-Brisingr avatar Dec 28 '23 10:12 Eragon-Brisingr