Closed Munksgaard closed 4 months ago
I can't really figure out if this is going to be a problem, but at least it's something to be aware of.
Would this work for you: https://github.com/rusterlium/rustler/tree/master/rustler_bigint ?
I can't really figure out if this is going to be a problem, but at least it's something to be aware of.
I don't think this is relevant for Rustler. It would be, if the NIF API actually included (C-based) support for 128-bit integer types, but it only supports up to 64.
If someone wants to work on this, https://github.com/rusterlium/rustler/tree/master/rustler_bigint can be taken as a basis. While that library is more general and implements support for arbitrarily-sized integers, the same approach (going via the term_to_binary
) can be used for the standard library types i128
and u128
.
I have not had time to look at the bigint library yet, but it indeed seems like the easiest way to handle something like this.
Implemented in #600.
Incredible! Thank you for your work @filmor!
Since both Rust and Elixir have support for 128-bit sized integers (i128, u128, erlang) it seems natural that Rustler should support it as well.
I have a specific use case for i128s as well, which is implementing support for the Decimal type from Polars in Explorer.