(root)/
gcc-13.2.0/
libdecnumber/
decQuad.c
       1  /* decQuad module for the decNumber C Library.
       2     Copyright (C) 2007-2023 Free Software Foundation, Inc.
       3     Contributed by IBM Corporation.  Author Mike Cowlishaw.
       4  
       5     This file is part of GCC.
       6  
       7     GCC is free software; you can redistribute it and/or modify it under
       8     the terms of the GNU General Public License as published by the Free
       9     Software Foundation; either version 3, or (at your option) any later
      10     version.
      11  
      12     GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      13     WARRANTY; without even the implied warranty of MERCHANTABILITY or
      14     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      15     for more details.
      16  
      17  Under Section 7 of GPL version 3, you are granted additional
      18  permissions described in the GCC Runtime Library Exception, version
      19  3.1, as published by the Free Software Foundation.
      20  
      21  You should have received a copy of the GNU General Public License and
      22  a copy of the GCC Runtime Library Exception along with this program;
      23  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      24  <http://www.gnu.org/licenses/>.  */
      25  
      26  /* ------------------------------------------------------------------ */
      27  /* decQuad.c -- decQuad operations module			      */
      28  /* ------------------------------------------------------------------ */
      29  /* This module comprises decQuad operations (including conversions)   */
      30  /* ------------------------------------------------------------------ */
      31  
      32  #include "decContext.h"       /* public includes */
      33  #include "decQuad.h"	      /* .. */
      34  
      35  /* Constant mappings for shared code */
      36  #define DECPMAX     DECQUAD_Pmax
      37  #define DECEMIN     DECQUAD_Emin
      38  #define DECEMAX     DECQUAD_Emax
      39  #define DECEMAXD    DECQUAD_EmaxD
      40  #define DECBYTES    DECQUAD_Bytes
      41  #define DECSTRING   DECQUAD_String
      42  #define DECECONL    DECQUAD_EconL
      43  #define DECBIAS     DECQUAD_Bias
      44  #define DECLETS     DECQUAD_Declets
      45  #define DECQTINY   (-DECQUAD_Bias)
      46  
      47  /* Type and function mappings for shared code */
      48  #define decFloat		   decQuad	  /* Type name */
      49  
      50  /* Utilities and conversions (binary results, extractors, etc.) */
      51  #define decFloatFromBCD 	   decQuadFromBCD
      52  #define decFloatFromInt32	   decQuadFromInt32
      53  #define decFloatFromPacked	   decQuadFromPacked
      54  #define decFloatFromPackedChecked  decQuadFromPackedChecked
      55  #define decFloatFromString	   decQuadFromString
      56  #define decFloatFromUInt32	   decQuadFromUInt32
      57  #define decFloatFromWider	   decQuadFromWider
      58  #define decFloatGetCoefficient	   decQuadGetCoefficient
      59  #define decFloatGetExponent	   decQuadGetExponent
      60  #define decFloatSetCoefficient	   decQuadSetCoefficient
      61  #define decFloatSetExponent	   decQuadSetExponent
      62  #define decFloatShow		   decQuadShow
      63  #define decFloatToBCD		   decQuadToBCD
      64  #define decFloatToEngString	   decQuadToEngString
      65  #define decFloatToInt32 	   decQuadToInt32
      66  #define decFloatToInt32Exact	   decQuadToInt32Exact
      67  #define decFloatToPacked	   decQuadToPacked
      68  #define decFloatToString	   decQuadToString
      69  #define decFloatToUInt32	   decQuadToUInt32
      70  #define decFloatToUInt32Exact	   decQuadToUInt32Exact
      71  #define decFloatToWider 	   decQuadToWider
      72  #define decFloatZero		   decQuadZero
      73  
      74  /* Computational (result is a decFloat) */
      75  #define decFloatAbs		   decQuadAbs
      76  #define decFloatAdd		   decQuadAdd
      77  #define decFloatAnd		   decQuadAnd
      78  #define decFloatDivide		   decQuadDivide
      79  #define decFloatDivideInteger	   decQuadDivideInteger
      80  #define decFloatFMA		   decQuadFMA
      81  #define decFloatInvert		   decQuadInvert
      82  #define decFloatLogB		   decQuadLogB
      83  #define decFloatMax		   decQuadMax
      84  #define decFloatMaxMag		   decQuadMaxMag
      85  #define decFloatMin		   decQuadMin
      86  #define decFloatMinMag		   decQuadMinMag
      87  #define decFloatMinus		   decQuadMinus
      88  #define decFloatMultiply	   decQuadMultiply
      89  #define decFloatNextMinus	   decQuadNextMinus
      90  #define decFloatNextPlus	   decQuadNextPlus
      91  #define decFloatNextToward	   decQuadNextToward
      92  #define decFloatOr		   decQuadOr
      93  #define decFloatPlus		   decQuadPlus
      94  #define decFloatQuantize	   decQuadQuantize
      95  #define decFloatReduce		   decQuadReduce
      96  #define decFloatRemainder	   decQuadRemainder
      97  #define decFloatRemainderNear	   decQuadRemainderNear
      98  #define decFloatRotate		   decQuadRotate
      99  #define decFloatScaleB		   decQuadScaleB
     100  #define decFloatShift		   decQuadShift
     101  #define decFloatSubtract	   decQuadSubtract
     102  #define decFloatToIntegralValue    decQuadToIntegralValue
     103  #define decFloatToIntegralExact    decQuadToIntegralExact
     104  #define decFloatXor		   decQuadXor
     105  
     106  /* Comparisons */
     107  #define decFloatCompare 	   decQuadCompare
     108  #define decFloatCompareSignal	   decQuadCompareSignal
     109  #define decFloatCompareTotal	   decQuadCompareTotal
     110  #define decFloatCompareTotalMag    decQuadCompareTotalMag
     111  
     112  /* Copies */
     113  #define decFloatCanonical	   decQuadCanonical
     114  #define decFloatCopy		   decQuadCopy
     115  #define decFloatCopyAbs 	   decQuadCopyAbs
     116  #define decFloatCopyNegate	   decQuadCopyNegate
     117  #define decFloatCopySign	   decQuadCopySign
     118  
     119  /* Non-computational */
     120  #define decFloatClass		   decQuadClass
     121  #define decFloatClassString	   decQuadClassString
     122  #define decFloatDigits		   decQuadDigits
     123  #define decFloatIsCanonical	   decQuadIsCanonical
     124  #define decFloatIsFinite	   decQuadIsFinite
     125  #define decFloatIsInfinite	   decQuadIsInfinite
     126  #define decFloatIsInteger	   decQuadIsInteger
     127  #define decFloatIsNaN		   decQuadIsNaN
     128  #define decFloatIsNormal	   decQuadIsNormal
     129  #define decFloatIsSignaling	   decQuadIsSignaling
     130  #define decFloatIsSignalling	   decQuadIsSignalling
     131  #define decFloatIsSigned	   decQuadIsSigned
     132  #define decFloatIsSubnormal	   decQuadIsSubnormal
     133  #define decFloatIsZero		   decQuadIsZero
     134  #define decFloatRadix		   decQuadRadix
     135  #define decFloatSameQuantum	   decQuadSameQuantum
     136  #define decFloatVersion 	   decQuadVersion
     137  
     138  #include "decNumberLocal.h"   /* local includes (need DECPMAX) */
     139  #include "decCommon.c"	      /* non-arithmetic decFloat routines */
     140  #include "decBasic.c"	      /* basic formats routines */
     141