Branch: Tag:

1999-03-03

1999-03-03 05:30:07 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

minor optimization

Rev: src/modules/Gmp/mpz_glue.c:1.41

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: mpz_glue.c,v 1.40 1999/03/02 03:13:35 hubbe Exp $"); + RCSID("$Id: mpz_glue.c,v 1.41 1999/03/03 05:30:07 hubbe Exp $");   #include "gmp_machine.h"      #if defined(HAVE_GMP2_GMP_H) && defined(HAVE_LIBGMP2)
498:    struct object *res;       for(e=0;e<args;e++) +  { +  if(sp[e-args].type != T_INT || sp[e-args].u.integer<=0)    if (!mpz_sgn(get_mpz(sp+e-args, 1)))    error("Division by zero.\n"); -  +  }       res = clone_object(mpzmod_program, 0);    mpz_set(OBTOMPZ(res), THIS);    for(e=0;e<args;e++) -  +  { +  if(sp[e-args].type == T_INT) +  mpz_fdiv_q_ui(OBTOMPZ(res), OBTOMPZ(res), sp[e-args].u.integer); +  else    mpz_fdiv_q(OBTOMPZ(res), OBTOMPZ(res), OBTOMPZ(sp[e-args].u.object)); -  +  }       pop_n_elems(args);    push_object(res);