diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-06-17 20:55:03 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-06-17 20:55:03 +0200 |
commit | b11b87db720955acae99a558ef18dd5b6995022d (patch) | |
tree | 9c59016bc43edfccc3a98080a0fe7c6d943b7331 /MLKInteger.m | |
parent | e10c42925058f0fbaa1a3398ddfa9441b33a4e72 (diff) |
MLKDynamicContext#+initialize: Initialise the package system and set up the global dynamic context.
Diffstat (limited to 'MLKInteger.m')
-rw-r--r-- | MLKInteger.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/MLKInteger.m b/MLKInteger.m index 7239f0b..10c3bca 100644 --- a/MLKInteger.m +++ b/MLKInteger.m @@ -29,6 +29,13 @@ return self; } +-(MLKInteger *) initWithInt:(int)intValue +{ + self = [super init]; + mpz_init_set_si (value, intValue); + return self; +} + -(MLKInteger *) initWithString:(NSString *)string negative:(BOOL)negative base:(unsigned int)base @@ -53,6 +60,12 @@ base:base]); } ++(MLKInteger *) integerWithInt:(int)intValue +{ + return AUTORELEASE ([[MLKInteger alloc] initWithInt:intValue]); +} + + #define DEFINE_MPZ_TWOARG_OPERATION(SELECTOR, GMPFUN) \ DEFINE_GMP_OPERATION (SELECTOR (MLKInteger *)arg, \ mpz, \ @@ -65,6 +78,7 @@ DEFINE_MPZ_TWOARG_OPERATION (subtract:, mpz_sub) DEFINE_MPZ_TWOARG_OPERATION (multiplyWith:, mpz_mul) DEFINE_MPZ_TWOARG_OPERATION (divideBy:, mpz_div) + -(int) intValue { return mpz_get_si (value); |