mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 19:19:53 +00:00
Make nanboxing on 64 bit platforms not the default.
64 bit nanboxing is kind of sketchy on non x86 architectures. 32 bit architectures seem to work better as the 32 implementation doesn't rely on the format of the address space and layout of double's in memory.
This commit is contained in:
parent
d1eca1cf52
commit
4ddf90e301
@ -83,6 +83,7 @@ static const JanetAbstractType it_u64_type = {
|
|||||||
|
|
||||||
int64_t janet_unwrap_s64(Janet x) {
|
int64_t janet_unwrap_s64(Janet x) {
|
||||||
switch (janet_type(x)) {
|
switch (janet_type(x)) {
|
||||||
|
default: break;
|
||||||
case JANET_NUMBER : {
|
case JANET_NUMBER : {
|
||||||
double dbl = janet_unwrap_number(x);
|
double dbl = janet_unwrap_number(x);
|
||||||
if (fabs(dbl) <= MAX_INT_IN_DBL)
|
if (fabs(dbl) <= MAX_INT_IN_DBL)
|
||||||
@ -110,6 +111,7 @@ int64_t janet_unwrap_s64(Janet x) {
|
|||||||
|
|
||||||
uint64_t janet_unwrap_u64(Janet x) {
|
uint64_t janet_unwrap_u64(Janet x) {
|
||||||
switch (janet_type(x)) {
|
switch (janet_type(x)) {
|
||||||
|
default: break;
|
||||||
case JANET_NUMBER : {
|
case JANET_NUMBER : {
|
||||||
double dbl = janet_unwrap_number(x);
|
double dbl = janet_unwrap_number(x);
|
||||||
if ((dbl >= 0) && (dbl <= MAX_INT_IN_DBL))
|
if ((dbl >= 0) && (dbl <= MAX_INT_IN_DBL))
|
||||||
|
@ -197,7 +197,10 @@ extern "C" {
|
|||||||
#ifndef JANET_NO_NANBOX
|
#ifndef JANET_NO_NANBOX
|
||||||
#ifdef JANET_32
|
#ifdef JANET_32
|
||||||
#define JANET_NANBOX_32
|
#define JANET_NANBOX_32
|
||||||
#else
|
#elif defined(__x86_64__) || defined(_WIN64)
|
||||||
|
/* We will only enable nanboxing by default on 64 bit systems
|
||||||
|
* on x86. This is mainly because the approach is tied to the
|
||||||
|
* implicit 47 bit address space. */
|
||||||
#define JANET_NANBOX_64
|
#define JANET_NANBOX_64
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user