X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/81578196d5732e443c75768ba9118c581c407cc7..02dfbd5b7af7816959dbd39c1fe628451204e35f:/mpx.h diff --git a/mpx.h b/mpx.h index bf73912..f79cffd 100644 --- a/mpx.h +++ b/mpx.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mpx.h,v 1.16 2003/05/16 09:09:24 mdw Exp $ + * $Id: mpx.h,v 1.18 2004/04/08 01:36:15 mdw Exp $ * * Low level multiprecision arithmetic * @@ -27,59 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: mpx.h,v $ - * Revision 1.16 2003/05/16 09:09:24 mdw - * Fix @mp_lsl2c@. Turns out to be surprisingly tricky. - * - * Revision 1.15 2002/10/19 17:56:50 mdw - * Fix bit operations. Test them (a bit) better. - * - * Revision 1.14 2002/10/09 00:36:03 mdw - * Fix bounds on workspace for Karatsuba operations. - * - * Revision 1.13 2002/10/06 22:52:50 mdw - * Pile of changes for supporting two's complement properly. - * - * Revision 1.12 2001/04/03 19:36:05 mdw - * Add some simple bitwise operations so that Perl can use them. - * - * Revision 1.11 2000/10/08 15:48:35 mdw - * Rename Karatsuba constants now that we have @gfx_kmul@ too. - * - * Revision 1.10 2000/10/08 12:06:12 mdw - * Provide @mpx_ueq@ for rapidly testing equality of two integers. - * - * Revision 1.9 1999/12/22 15:49:07 mdw - * New function for division by a small integer. - * - * Revision 1.8 1999/12/11 10:57:43 mdw - * Karatsuba squaring algorithm. - * - * Revision 1.7 1999/12/11 01:51:28 mdw - * Change Karatsuba parameters slightly. - * - * Revision 1.6 1999/12/10 23:23:51 mdw - * Karatsuba-Ofman multiplication algorithm. - * - * Revision 1.5 1999/11/20 22:23:27 mdw - * Add function versions of some low-level macros with wider use. - * - * Revision 1.4 1999/11/17 18:04:43 mdw - * Add two's complement support. Fix a bug in MPX_UMLAN. - * - * Revision 1.3 1999/11/13 01:51:29 mdw - * Minor interface changes. Should be stable now. - * - * Revision 1.2 1999/11/11 17:47:55 mdw - * Minor changes for different `mptypes.h' format. - * - * Revision 1.1 1999/09/03 08:41:12 mdw - * Initial import. - * - */ - #ifndef CATACOMB_MPX_H #define CATACOMB_MPX_H @@ -560,6 +507,22 @@ extern void mpx_uadd(mpw */*dv*/, mpw */*dvl*/, extern void mpx_uaddn(mpw */*dv*/, mpw */*dvl*/, mpw /*n*/); +/* --- @mpx_uaddnlsl@ --- * + * + * Arguments: @mpw *dv, *dvl@ = destination and first argument vector + * @mpw a@ = second argument + * @unsigned o@ = offset in bits + * + * Returns: --- + * + * Use: Computes %$d + 2^o a$%. If the result overflows then + * high-order bits are discarded, as usual. We must have + * @0 < o < MPW_BITS@. + */ + +extern void mpx_uaddnlsl(mpw */*dv*/, mpw */*dvl*/, + mpw /*a*/, unsigned /*o*/); + /* --- @mpx_usub@ --- * * * Arguments: @mpw *dv, *dvl@ = destination vector base and limit @@ -607,6 +570,23 @@ extern void mpx_usub(mpw */*dv*/, mpw */*dvl*/, extern void mpx_usubn(mpw */*dv*/, mpw */*dvl*/, mpw /*n*/); +/* --- @mpx_usubnlsl@ --- * + * + * Arguments: @mpw *dv, *dvl@ = destination and first argument vector + * @mpw a@ = second argument + * @unsigned o@ = offset in bits + * + * Returns: --- + * + * Use: Computes %$d - 2^o a$%. If the result overflows then + * high-order bits are discarded, as usual, so you get two's + * complement. Which might be what you wanted... We must have + * @0 < o < MPW_BITS@. + */ + +extern void mpx_usubnlsl(mpw */*dv*/, mpw */*dvl*/, + mpw /*a*/, unsigned /*o*/); + /* --- @mpx_umul@ --- * * * Arguments: @mpw *dv, *dvl@ = destination vector base and limit