xref: /netbsd-src/external/gpl3/gdb/dist/libdecnumber/dpd/decimal128Local.h (revision 4559860ef23039476746699b4757c1b6983b488b)
14e98e3e1Schristos /* Local definitions for use with the decNumber C Library.
2*4559860eSchristos    Copyright (C) 2007-2018 Free Software Foundation, Inc.
34e98e3e1Schristos 
44e98e3e1Schristos    This file is part of GCC.
54e98e3e1Schristos 
64e98e3e1Schristos    GCC is free software; you can redistribute it and/or modify it under
74e98e3e1Schristos    the terms of the GNU General Public License as published by the Free
84e98e3e1Schristos    Software Foundation; either version 3, or (at your option) any later
94e98e3e1Schristos    version.
104e98e3e1Schristos 
114e98e3e1Schristos    GCC is distributed in the hope that it will be useful, but WITHOUT ANY
124e98e3e1Schristos    WARRANTY; without even the implied warranty of MERCHANTABILITY or
134e98e3e1Schristos    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
144e98e3e1Schristos    for more details.
154e98e3e1Schristos 
164e98e3e1Schristos Under Section 7 of GPL version 3, you are granted additional
174e98e3e1Schristos permissions described in the GCC Runtime Library Exception, version
184e98e3e1Schristos 3.1, as published by the Free Software Foundation.
194e98e3e1Schristos 
204e98e3e1Schristos You should have received a copy of the GNU General Public License and
214e98e3e1Schristos a copy of the GCC Runtime Library Exception along with this program;
224e98e3e1Schristos see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
234e98e3e1Schristos <http://www.gnu.org/licenses/>.  */
244e98e3e1Schristos 
254e98e3e1Schristos #if !defined(DECIMAL128LOCAL)
264e98e3e1Schristos 
274e98e3e1Schristos /* The compiler needs sign manipulation functions for decimal128 which
284e98e3e1Schristos    are not part of the decNumber package.  */
294e98e3e1Schristos 
304e98e3e1Schristos /* Set sign; this assumes the sign was previously zero.  */
314e98e3e1Schristos #define decimal128SetSign(d,b) \
324e98e3e1Schristos   { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] |= ((unsigned) (b) << 7); }
334e98e3e1Schristos 
344e98e3e1Schristos /* Clear sign.  */
354e98e3e1Schristos #define decimal128ClearSign(d) \
364e98e3e1Schristos   { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] &= ~0x80; }
374e98e3e1Schristos 
384e98e3e1Schristos /* Flip sign.  */
394e98e3e1Schristos #define decimal128FlipSign(d) \
404e98e3e1Schristos   { (d)->bytes[WORDS_BIGENDIAN ? 0 : 15] ^= 0x80; }
414e98e3e1Schristos 
424e98e3e1Schristos #endif
43