Skip to content

Commit

Permalink
gmpints: remove NEW_INTPOS
Browse files Browse the repository at this point in the history
After all my refactoring, there was only one caller left.
  • Loading branch information
fingolfin committed Jan 13, 2017
1 parent 4481627 commit b4c4428
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/gmpints.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,24 +242,6 @@ void LoadInt( Obj gmp )
}


/****************************************************************************
**
*F NEW_INTPOS( <gmp> )
**
** Take an T_INTPOS or T_INTNEG and create a new T_INTPOS with identical
** content. Useful to duplicate integers, or take the absolute value.
*/
static inline Obj NEW_INTPOS( Obj gmp )
{
Obj new;

new = NewBag( T_INTPOS, SIZE_OBJ(gmp) );
memcpy( ADDR_INT(new), ADDR_INT(gmp), SIZE_OBJ(gmp) );

return new;
}


/****************************************************************************
**
** In order to use the high-level GMP mpz_* functions conveniently while
Expand Down Expand Up @@ -1119,7 +1101,9 @@ Obj AbsInt( Obj op )
if ( IS_INTPOS(op) ) {
return op;
} else if ( IS_INTNEG(op) ) {
return NEW_INTPOS(op);
a = NewBag( T_INTPOS, SIZE_OBJ(op) );
memcpy( ADDR_INT(a), ADDR_INT(op), SIZE_OBJ(op) );
return op;
}
return Fail;
}
Expand Down

0 comments on commit b4c4428

Please sign in to comment.