diff options
-rw-r--r-- | MLKInteger.m | 8 | ||||
-rw-r--r-- | MLKRoot.m | 5 | ||||
-rw-r--r-- | functions.m | 2 |
3 files changed, 15 insertions, 0 deletions
diff --git a/MLKInteger.m b/MLKInteger.m index 43af24d..b2ce0a8 100644 --- a/MLKInteger.m +++ b/MLKInteger.m @@ -165,12 +165,20 @@ DEFINE_MPZ_TWOARG_INTONLY_OPERATION (lcm:, mpz_lcm) -(BOOL) fitsIntoFixnum { +#ifdef NO_FIXNUMS + return NO; +#else return (mpz_sizeinbase (self->value, 2) <= (sizeof (id)) * 8 - 2); +#endif } -(id) fixnumValue { +#ifdef NO_FIXNUMS + return self; +#else return MLKFixnumWithInt ([self intValue]); +#endif } -(int) intValue @@ -170,8 +170,13 @@ static id truify (BOOL value) +(NSArray *) fixnum_eq:(NSArray *)args { +#ifdef NO_FIXNUMS + RETURN_VALUE (truify ([[args objectAtIndex:0] + isEqual:[args objectAtIndex:1]])); +#else RETURN_VALUE (truify (denullify([args objectAtIndex:0]) == denullify([args objectAtIndex:1]))); +#endif } +(NSArray *) symbolp:(NSArray *)args diff --git a/functions.m b/functions.m index 068d217..ef3e6c3 100644 --- a/functions.m +++ b/functions.m @@ -48,10 +48,12 @@ id MLKFixnumWithInt (intptr_t value) id MLKIntegerWithInt (intptr_t value) { +#ifndef NO_FIXNUMS intptr_t maybeFixnum = (value << 1) | 1; if (value == (maybeFixnum >> 1)) return (id)maybeFixnum; else +#endif return [MLKInteger integerWithIntptr_t:value]; } |