summaryrefslogtreecommitdiff
path: root/MLKInteger.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-17 20:55:03 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-17 20:55:03 +0200
commitb11b87db720955acae99a558ef18dd5b6995022d (patch)
tree9c59016bc43edfccc3a98080a0fe7c6d943b7331 /MLKInteger.m
parente10c42925058f0fbaa1a3398ddfa9441b33a4e72 (diff)
MLKDynamicContext#+initialize: Initialise the package system and set up the global dynamic context.
Diffstat (limited to 'MLKInteger.m')
-rw-r--r--MLKInteger.m14
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);