Blame sysdeps/ieee754/dbl-64/mpa-arch.h

Packit 6c4009
/* Overridable constants and operations.
Packit 6c4009
   Copyright (C) 2013-2018 Free Software Foundation, Inc.
Packit 6c4009
Packit 6c4009
   This program is free software; you can redistribute it and/or modify
Packit 6c4009
   it under the terms of the GNU Lesser General Public License as published by
Packit 6c4009
   the Free Software Foundation; either version 2.1 of the License, or
Packit 6c4009
   (at your option) any later version.
Packit 6c4009
Packit 6c4009
   This program is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 6c4009
   GNU Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public License
Packit 6c4009
   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <stdint.h>
Packit 6c4009
Packit 6c4009
typedef long mantissa_t;
Packit 6c4009
typedef int64_t mantissa_store_t;
Packit 6c4009
Packit 6c4009
#define TWOPOW(i) (1L << i)
Packit 6c4009
Packit 6c4009
#define RADIX_EXP 24
Packit 6c4009
#define  RADIX TWOPOW (RADIX_EXP)               /* 2^24    */
Packit 6c4009
Packit 6c4009
/* Divide D by RADIX and put the remainder in R.  D must be a non-negative
Packit 6c4009
   integral value.  */
Packit 6c4009
#define DIV_RADIX(d, r) \
Packit 6c4009
  ({                                                                         \
Packit 6c4009
     r = d & (RADIX - 1);                                                    \
Packit 6c4009
     d >>= RADIX_EXP;                                                        \
Packit 6c4009
   })
Packit 6c4009
Packit 6c4009
/* Put the integer component of a double X in R and retain the fraction in
Packit 6c4009
   X.  This is used in extracting mantissa digits for MP_NO by using the
Packit 6c4009
   integer portion of the current value of the number as the current mantissa
Packit 6c4009
   digit and then scaling by RADIX to get the next mantissa digit in the same
Packit 6c4009
   manner.  */
Packit 6c4009
#define INTEGER_OF(x, i) \
Packit 6c4009
  ({                                                                          \
Packit 6c4009
     i = (mantissa_t) x;                                                       \
Packit 6c4009
     x -= i;                                                                   \
Packit 6c4009
   })
Packit 6c4009
Packit 6c4009
/* Align IN down to F.  The code assumes that F is a power of two.  */
Packit 6c4009
#define ALIGN_DOWN_TO(in, f) ((in) & - (f))