]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/ieee754/dbl-64/mpa-arch.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / ieee754 / dbl-64 / mpa-arch.h
CommitLineData
6f2e90e7 1/* Overridable constants and operations.
688903eb 2 Copyright (C) 2013-2018 Free Software Foundation, Inc.
6f2e90e7
SP
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
16
17#include <stdint.h>
18
19typedef long mantissa_t;
20typedef int64_t mantissa_store_t;
21
22#define TWOPOW(i) (1L << i)
23
24#define RADIX_EXP 24
c5d5d574 25#define RADIX TWOPOW (RADIX_EXP) /* 2^24 */
6f2e90e7
SP
26
27/* Divide D by RADIX and put the remainder in R. D must be a non-negative
28 integral value. */
29#define DIV_RADIX(d, r) \
c5d5d574
OB
30 ({ \
31 r = d & (RADIX - 1); \
32 d >>= RADIX_EXP; \
33 })
6f2e90e7
SP
34
35/* Put the integer component of a double X in R and retain the fraction in
36 X. This is used in extracting mantissa digits for MP_NO by using the
37 integer portion of the current value of the number as the current mantissa
38 digit and then scaling by RADIX to get the next mantissa digit in the same
39 manner. */
40#define INTEGER_OF(x, i) \
c5d5d574
OB
41 ({ \
42 i = (mantissa_t) x; \
43 x -= i; \
44 })
6f2e90e7
SP
45
46/* Align IN down to F. The code assumes that F is a power of two. */
c5d5d574 47#define ALIGN_DOWN_TO(in, f) ((in) & - (f))