/*
   This file is part of Numerix.  Numerix is free software; you can
   redistribute it and/or modify it under the terms of the GNU General
   Public License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
   USA 
*/

/*+----------------------------------------------------------------------------+
  |                                                                            |
  |                       Entiers de longueur arbitraire                       |
  |                                                                            |
  |                            Macros assembleur x86                           |
  |                                                                            |
  +----------------------------------------------------------------------------+*/

/* M. Quercia, 06/02/2001 */

#include "../kernel/long_int-s.h"


/* entrée et retour de fonction */
#define  ENTER(nom)                \
        .align 4                  ;\
        .globl nom                ;\
        .type  nom,@function      ;\
nom:                              ;\
        pushl  %ebp               ;\
        movl   %esp,%ebp          ;\
        pushl  %edi               ;\
        pushl  %esi               ;\
        pushl  %ebx

#define  RETURN                    \
        movl   -12(%ebp),%ebx     ;\
        movl    -8(%ebp),%esi     ;\
        movl    -4(%ebp),%edi     ;\
        movl   %ebp,%esp          ;\
        popl   %ebp               ;\
        ret

#define  EXIT(nom)                 \
.L##nom##_exit:                   ;\
RETURN

#define SIGN_m 0x80000000
#define LONG_m 0x7fffffff

/* accès aux paramètres d'appel */
#define a       8(%ebp)
#define la     12(%ebp)
#define b      16(%ebp)
#define lb     20(%ebp)
#define c      24(%ebp)
#define d      28(%ebp)

#define za      8(%ebp)
#define zb     12(%ebp)
#define zc     16(%ebp)
#define zd     20(%ebp)

#define arg1    8(%ebp)
#define arg2   12(%ebp)
#define arg3   16(%ebp)
#define arg4   20(%ebp)
#define arg5   24(%ebp)
#define arg6   28(%ebp)
#define arg7   32(%ebp)
#define arg8   36(%ebp)

/* limite entre Karatsuba et la multiplication ordinaire */
/* trop compliqué de faire prendre en compte la valeur   */
/* définie dans long_int.h, elle est recopiée ici ...    */
/* attention aux mises à jour!                           */
#define klim  32
#define kprof 31

/* multiplication par FFt à partir de 30000 bits */
#define flim  937
