xref: /qemu/include/libdecnumber/dpd/decimal128Local.h (revision af44da87e926ff64260b95f4350d338c4fc113ca)
1*72ac97cdSTom Musta /* Local definitions for use with the decNumber C Library.
2*72ac97cdSTom Musta    Copyright (C) 2007 Free Software Foundation, Inc.
3*72ac97cdSTom Musta 
4*72ac97cdSTom Musta    This file is part of GCC.
5*72ac97cdSTom Musta 
6*72ac97cdSTom Musta    GCC is free software; you can redistribute it and/or modify it under
7*72ac97cdSTom Musta    the terms of the GNU General Public License as published by the Free
8*72ac97cdSTom Musta    Software Foundation; either version 2, or (at your option) any later
9*72ac97cdSTom Musta    version.
10*72ac97cdSTom Musta 
11*72ac97cdSTom Musta    In addition to the permissions in the GNU General Public License,
12*72ac97cdSTom Musta    the Free Software Foundation gives you unlimited permission to link
13*72ac97cdSTom Musta    the compiled version of this file into combinations with other
14*72ac97cdSTom Musta    programs, and to distribute those combinations without any
15*72ac97cdSTom Musta    restriction coming from the use of this file.  (The General Public
16*72ac97cdSTom Musta    License restrictions do apply in other respects; for example, they
17*72ac97cdSTom Musta    cover modification of the file, and distribution when not linked
18*72ac97cdSTom Musta    into a combine executable.)
19*72ac97cdSTom Musta 
20*72ac97cdSTom Musta    GCC is distributed in the hope that it will be useful, but WITHOUT ANY
21*72ac97cdSTom Musta    WARRANTY; without even the implied warranty of MERCHANTABILITY or
22*72ac97cdSTom Musta    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23*72ac97cdSTom Musta    for more details.
24*72ac97cdSTom Musta 
25*72ac97cdSTom Musta    You should have received a copy of the GNU General Public License
26*72ac97cdSTom Musta    along with GCC; see the file COPYING.  If not, write to the Free
27*72ac97cdSTom Musta    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
28*72ac97cdSTom Musta    02110-1301, USA.  */
29*72ac97cdSTom Musta 
30*72ac97cdSTom Musta #if !defined(DECIMAL128LOCAL)
31*72ac97cdSTom Musta 
32*72ac97cdSTom Musta /* The compiler needs sign manipulation functions for decimal128 which
33*72ac97cdSTom Musta    are not part of the decNumber package.  */
34*72ac97cdSTom Musta 
35*72ac97cdSTom Musta /* Set sign; this assumes the sign was previously zero.  */
36*72ac97cdSTom Musta #define decimal128SetSign(d,b) \
37*72ac97cdSTom Musta   { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] |= ((unsigned) (b) << 7); }
38*72ac97cdSTom Musta 
39*72ac97cdSTom Musta /* Clear sign.  */
40*72ac97cdSTom Musta #define decimal128ClearSign(d) \
41*72ac97cdSTom Musta   { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] &= ~0x80; }
42*72ac97cdSTom Musta 
43*72ac97cdSTom Musta /* Flip sign.  */
44*72ac97cdSTom Musta #define decimal128FlipSign(d) \
45*72ac97cdSTom Musta   { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] ^= 0x80; }
46*72ac97cdSTom Musta 
47*72ac97cdSTom Musta #endif
48