5 # Multiprecision interface
7 # (c) 2000 Straylight/Edgeware
10 #----- Licensing notice -----------------------------------------------------
12 # This file is part of the Perl interface to Catacomb.
14 # Catacomb/Perl is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
19 # Catacomb/Perl is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with Catacomb/Perl; if not, write to the Free Software Foundation,
26 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 MODULE = Catacomb PACKAGE = Catacomb::GF PREFIX = gf_
32 new(me, sv = 0, radix = 0)
37 RETVAL = sv ? mp_fromsv(sv, "sv", radix, 1) : MP_ZERO;
58 RETVAL = mp_loadb(MP_NEW, p, len);
71 RETVAL = mp_loadl(MP_NEW, p, len);
82 XSINTERFACE_FUNC_SETGF
94 XSINTERFACE_FUNC_SETGF
106 XSINTERFACE_FUNC_SETMP
117 XSINTERFACE_FUNC_SETMP
129 XSINTERFACE_FUNC_SETMP
141 XSINTERFACE_FUNC_SETMP
154 mp *q = MP_NEW, *r = MP_NEW;
156 if (MP_EQ(b, MP_ZERO))
157 croak("Divide by zero in Catacomb::GF::div");
162 mp_div(&q, &r, a, b);
170 mp_div(&q, &r, a, b);
181 gf *g = MP_NEW, *x = MP_NEW, *y = MP_NEW;
185 gf_gcd(&g, &x, &y, a, b);
194 gf_gcd(&g, 0, 0, a, b);
200 MODULE = Catacomb PACKAGE = Catacomb::GF::Reduce PREFIX = gfreduce_
206 RETVAL = CREATE(GF_Reduce);
207 gfreduce_create(RETVAL, x);
224 RETVAL = gfreduce_do(r, MP_NEW, x);
233 if ((RETVAL = gfreduce_sqrt(r, MP_NEW, x)) == 0)
244 gfreduce_halftrace(r, x)
255 if ((RETVAL = gfreduce_quadsolve(r, MP_NEW, x)) == 0)
264 RETVAL = MP_COPY(r->p);
269 gfreduce_exp(r, x, y)
276 #----- That's all, folks ----------------------------------------------------