From ebda48e66584c562d3c1f44693b0041fca36e926 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 15 Jun 2008 22:29:58 +0200 Subject: Move the DEFINE_GMP_OPERATION macro to util.h. --- MLKInteger.m | 16 +--------------- util.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 util.h diff --git a/MLKInteger.m b/MLKInteger.m index e659348..95b2e4a 100644 --- a/MLKInteger.m +++ b/MLKInteger.m @@ -17,10 +17,10 @@ */ #import "MLKInteger.h" +#import "util.h" #import - @implementation MLKInteger -(MLKInteger *) initWithMPZ:(mpz_t)mpz { @@ -53,20 +53,6 @@ base:base]); } -#define DEFINE_GMP_OPERATION(SIGNATURE, TYPE, GMPOP, OBJTYPE, CONSTRUCTOR) \ - -(OBJTYPE *) SIGNATURE \ - { \ - TYPE##_t mpval; \ - OBJTYPE *result; \ - \ - TYPE##_init (mpval); \ - GMPOP; \ - result = [OBJTYPE CONSTRUCTOR mpval]; \ - TYPE##_clear (mpval); \ - \ - return result; \ - } - #define DEFINE_MPZ_TWOARG_OPERATION(SELECTOR, GMPFUN) \ DEFINE_GMP_OPERATION (SELECTOR (MLKInteger *)arg, \ mpz, \ diff --git a/util.h b/util.h new file mode 100644 index 0000000..7a73d22 --- /dev/null +++ b/util.h @@ -0,0 +1,13 @@ +#define DEFINE_GMP_OPERATION(SIGNATURE, TYPE, GMPOP, OBJTYPE, CONSTRUCTOR) \ + -(OBJTYPE *) SIGNATURE \ + { \ + TYPE##_t mpval; \ + OBJTYPE *result; \ + \ + TYPE##_init (mpval); \ + GMPOP; \ + result = [OBJTYPE CONSTRUCTOR mpval]; \ + TYPE##_clear (mpval); \ + \ + return result; \ + } -- cgit v1.2.3