-
Notifications
You must be signed in to change notification settings - Fork 224
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
Bigint #71
Bigint #71
Conversation
Another case that triggers an exception is INT64_MIN / -1, which affects all signed integer types on most architectures - we should probably try to detect this. |
Fixed in jfcap@c5217da
|
for better compatibility with default janet number reader
Thanks for all the changes! I will give these changes a spin soon and probably merge everything if there are no immediate issues. Just a minor thing about names -- "bigint" usually implies python/GMP style integers of unlimited precision. These 64 bit integers have a different role, mainly providing an interface to C APIs where 64 bits integers are used. Perhaps we could rename the module to just |
Feel free to rename everything as you think it's better. |
A lot of refactoring larger integer types. Fix a number of casting errors, but mostly rename things. Also try to limit use of template-like macros as they bloat the binary if not used in moderation. We were able to reduce the size of typed array code as well by using a single view types.
A bit of an explanation for the changes I have made: We can still use and create typed arrays with 64 bit integers, even if JANET_NO_INT_TYPES (previously JANET_NO_BIGINT) is set. However, we can't get and set in them from Janet without the I have also made typed array views all share a single abstract type. This is kind of a large change for this branch, but it made code cleaner. The main difference for a user is typed arrays now all print out as |
Thanks for the merge. After your changes there is some "dead code" in pp.c case JANET_ABSTRACT: {
#ifdef JANET_BIGINT
JanetBigintType bt = janet_is_bigint(x);
if (bt == JANET_BIGINT_TYPE_int64) {
int64_to_string_b(buffer, *(int64_t *)janet_unwrap_abstract(x));
return;
}
if (bt == JANET_BIGINT_TYPE_uint64) {
uint64_to_string_b(buffer, *(uint64_t *)janet_unwrap_abstract(x));
return;
}
#endif The good way to correct this is probably to implement your proposal #73 |
Fixes #67
Bigint for Janet implementation proposal