linux/include/math-emu/single.h
<<
>>
Prefs
   1/* Software floating-point emulation.
   2   Definitions for IEEE Single Precision.
   3   Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
   4   This file is part of the GNU C Library.
   5   Contributed by Richard Henderson (rth@cygnus.com),
   6                  Jakub Jelinek (jj@ultra.linux.cz),
   7                  David S. Miller (davem@redhat.com) and
   8                  Peter Maydell (pmaydell@chiark.greenend.org.uk).
   9
  10   The GNU C Library is free software; you can redistribute it and/or
  11   modify it under the terms of the GNU Library General Public License as
  12   published by the Free Software Foundation; either version 2 of the
  13   License, or (at your option) any later version.
  14
  15   The GNU C Library is distributed in the hope that it will be useful,
  16   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18   Library General Public License for more details.
  19
  20   You should have received a copy of the GNU Library General Public
  21   License along with the GNU C Library; see the file COPYING.LIB.  If
  22   not, write to the Free Software Foundation, Inc.,
  23   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  24
  25#ifndef    __MATH_EMU_SINGLE_H__
  26#define    __MATH_EMU_SINGLE_H__
  27
  28#if _FP_W_TYPE_SIZE < 32
  29#error "Here's a nickel kid.  Go buy yourself a real computer."
  30#endif
  31
  32#define _FP_FRACBITS_S          24
  33#define _FP_FRACXBITS_S         (_FP_W_TYPE_SIZE - _FP_FRACBITS_S)
  34#define _FP_WFRACBITS_S         (_FP_WORKBITS + _FP_FRACBITS_S)
  35#define _FP_WFRACXBITS_S        (_FP_W_TYPE_SIZE - _FP_WFRACBITS_S)
  36#define _FP_EXPBITS_S           8
  37#define _FP_EXPBIAS_S           127
  38#define _FP_EXPMAX_S            255
  39#define _FP_QNANBIT_S           ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-2))
  40#define _FP_IMPLBIT_S           ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-1))
  41#define _FP_OVERFLOW_S          ((_FP_W_TYPE)1 << (_FP_WFRACBITS_S))
  42
  43/* The implementation of _FP_MUL_MEAT_S and _FP_DIV_MEAT_S should be
  44   chosen by the target machine.  */
  45
  46union _FP_UNION_S
  47{
  48  float flt;
  49  struct {
  50#if __BYTE_ORDER == __BIG_ENDIAN
  51    unsigned sign : 1;
  52    unsigned exp  : _FP_EXPBITS_S;
  53    unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
  54#else
  55    unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
  56    unsigned exp  : _FP_EXPBITS_S;
  57    unsigned sign : 1;
  58#endif
  59  } bits __attribute__((packed));
  60};
  61
  62#define FP_DECL_S(X)            _FP_DECL(1,X)
  63#define FP_UNPACK_RAW_S(X,val)  _FP_UNPACK_RAW_1(S,X,val)
  64#define FP_UNPACK_RAW_SP(X,val) _FP_UNPACK_RAW_1_P(S,X,val)
  65#define FP_PACK_RAW_S(val,X)ref">FP_DECL_S(_FP_PACK_RAW_1(S,,X,val)
           8
,val) (_FP_PACK_RAW_1(sign : 6;
_FP_FRAodeINHIs="lRESULssbits S>S,X,val)
(_FP_PACK_RAW_1(  62#define FP_DECL_S(X,val)  _FP_UNPACK_RAW_1(FP_UN7ACK_R73ef="indo {                                  \="L65" class="line" name="L65"code=FP7UNPACK_R7W_SP" class="sref">FP_U7PACK_74)1 <&href="+code=S" class="sref">S,X,val)
FP_PACK7RAW_S75)1 <&href="+code=S" class="srefCANONICAa href="include/maths="srefCANONICAaf">X,le.h#L63" id="L63" class="line" name="L;+code=X"\="L65" class="line" name="L65"code=FP7        7    Jakub Jelinek (jj@u7 href76tribute_wh="L2(0d="L65" class="line" name="L65"code=FP7             David S. Miller (dav;
  28#if ,val) _FP_UNPACK_RAW_1_P            \="L65" class="line" name="L65"code=FP7lass="sr7f">bits SS,X,val)
X,le.h#L63" id="L63" class="line" name="L;+code=X"\="L65" class="line" name="L65"code=FP8DECL_S" 8lass="sref">FP_DECL_S(FP_UN8ACK_R83e="L28">  28#if FP_U8PACK_8AW_SP(,val)  (_FP_PACK_RAW_1(FP_PACK8RAW_S85ef="indo {                                  \="L65" class="line" name="L65"code=FP8        8    Jakub Jelinek (jj@u8 href86)1 <&href="+code=S" clas"srefCANONICAa href="include/math"srefCANONICAaf">X,le.h#L63" id="L63" class="line" name="L;+code=X"  \="L65" class="line" name="L65"code=FP8        8    David S. Miller (da8;
,,X,val)
bits   20   9mu/singl9.h#L61" id="L61" class=9line"9/a>           ((,val) (_FP_PACK_RAW_1(FP_DECL_S(X,le.h#L63" id="L63" class="line" name="L;+code=X"  \="L65" class="line" name="L65"code=FP9UNPACK_R9W_S" class="sref">FP_UN9ACK_R9="+code=_ef=(! 8
_FP_FRAodeINHIs="lRESULssFP_U9PACK_94)1 <<="+code=S" class="sref">S>S,X,val)
(_FP_PACK_RAW_1(FP_PACK9RAW_S95tribute_wh="L2(0d="L65" class="line" name="L65"code=FP9        9    Jakub Jelinek (jj@u9 href96e="L20">  20   9        9    David S. Miller (da9;
           127
_FP_DECL(1,X,le.h#L63" id="L63" class="line" name="L20">  20   9        9    Peter Maydell (pmay9ss="l9>            255
X,__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(X,le.h#L63" id="L63="sref">__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(  20   9ingle.h#LL10" id="L10" class="linde=__9/a>           ((X,__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(X,le.h#L63" id="L63="sref">__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(  10   Thhe GNU C LLibrary is free software;linee;la>           ((X,__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(X,le.h#L63" id="L63="sref">__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(  10   Thodify it 0under the terms of the G01inee;S          ((X,__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(X,le.h#L63" id="L63="sref">__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(  10   Thublished 0by the Free Software Fou02inee;ref="+code=X" class="sref">XIV          X,__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(X,le.h#L63" id="L63="sref">__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(  10   Thicense, o0r (at your option) any l03inee;W_S(X,__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(X,le.h#L63" id="L63="sref">__BIG_ENRRAW_1" class="sref">_FP_PACK_RAW_1(  20   10/single.h0#L15" id="L15" class="li04inee;S_S         (X,__BIG_ENRRAW_1" class="sref">ode=val" class="sref">val)
_FP_PACK_RAW_1(QFP_PACK_RAW_1(,f">X,__BIG_ENRRAW_1" class="sref">ode=val" class="sref">val)
_FP_PACK_RAW_1(QFP_PACK_RAW_1(  20   10he GNU C 0Library is distributed i05inee;me="L46">  46union X,_FP_PACK_RAW_1(YFP_PACK_RAW_1(uid="L58" class="un>(X,le.h#L63" id="L63rle.h#L56" id="LrRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(uid="L58" class="un>(  46union X,_FP_PACK_RAW_1(YFP_PACK_RAW_1(X,le.h#L63" id="L63rle.h#L56" id="LrRAW_1" class="sref">_FP_PACK_RAW_1(YFP_PACK_RAW_1(  46union   46union X,_FP_PACK_RAW_1(rszle.h#L56" id="Lrsz>(rsgle.h#L56" id="Lrsg>(X,le.h#L63" id="L63rle.h#L56" id="LrRAW_1" class="sref">_FP_PACK_RAW_1(rszle.h#L56" id="Lrsz>(rsgle.h#L56" id="Lrsg>(  11   mohe GNU C  Library is free softwaree; yo11la>           ((X,_FP_PACK_RAW_1(rszle.h#L56" id="Lrsz>(rsgle.h#L56" id="Lrsg>(X,le.h#L63" id="L63rle.h#L56" id="LrRAW_1" class="sref">_FP_PACK_RAW_1(rszle.h#L56" id="Lrsz>(rsgle.h#L56" id="Lrsg>(  11   moodify it uunder the terms of the GN1inee1S          ((_FP_DECL(1,rattribute__(rsRAW_1" class="sref">r49" class="line"rt>(X,le.h#L63" id="L63" class="line" name="e.h#L63" id="L63rle.h#L56" id="LrRAW_1" class="sref">rattribute__(rsRAW_1" class="sref">r49" class="line"rt>(  11   moublished  by the Free Software Fouundat11me="L43">  43/* 1License, oor (at your option) any llater11S_S         (_FP_IMPLBIT_S_HIGHlaFP_DECL" class="sref">_FP_DECL(1,FP_DECL" class="sref">_FP_DECL(1,  43/* 1L/single.hh#L15" id="L15" class="liine" 11S_S         (val_FP_DECL(1,FP_DECL" class="sref">_FP_DECL(1,  43/* 1Lhe GNU C  Library is distributed iin th11me="L46">  46union   45

n>
  45LXR-ouldunityRAW_1 put  experif="inl13" class45"5">  45lxr@="linenoRAW_.
id="7e/f/55eTY or Fsubfooter">
lxr.="lineno kindly hosh-emu/s5">  45Redpill L"lpro Asref"> proviref=of L"lux-ounpre e/mh#L44operale.h#Lservice#Lsa>
e/mat5.
id="7e/2f/bodye/f/html