~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/math-emu/op-8.h

Version: ~ [ linux-6.1-rc7 ] ~ [ linux-6.0.10 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.80 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.156 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.225 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.267 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.300 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.334 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* Software floating-point emulation.
  2    Basic eight-word fraction declaration and manipulation.
  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) and
  7                   Peter Maydell (pmaydell@chiark.greenend.org.uk).
  8                                                          
  9    The GNU C Library is free software; you can redistribute it and/or
 10    modify it under the terms of the GNU Library General Public License as
 11    published by the Free Software Foundation; either version 2 of the
 12    License, or (at your option) any later version.
 13 
 14    The GNU C Library is distributed in the hope that it will be useful,
 15    but WITHOUT ANY WARRANTY; without even the implied warranty of
 16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17    Library General Public License for more details.
 18 
 19    You should have received a copy of the GNU Library General Public
 20    License along with the GNU C Library; see the file COPYING.LIB.  If
 21    not, write to the Free Software Foundation, Inc.,
 22    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 23 
 24 #ifndef __MATH_EMU_OP_8_H__
 25 #define __MATH_EMU_OP_8_H__
 26 
 27 /* We need just a few things from here for op-4, if we ever need some
 28    other macros, they can be added. */
 29 #define _FP_FRAC_DECL_8(X)      _FP_W_TYPE X##_f[8]
 30 #define _FP_FRAC_HIGH_8(X)      (X##_f[7])
 31 #define _FP_FRAC_LOW_8(X)       (X##_f[0])
 32 #define _FP_FRAC_WORD_8(X,w)    (X##_f[w])
 33 
 34 #define _FP_FRAC_SLL_8(X,N)                                             \
 35   do {                                                                  \
 36     _FP_I_TYPE _up, _down, _skip, _i;                                   \
 37     _skip = (N) / _FP_W_TYPE_SIZE;                                      \
 38     _up = (N) % _FP_W_TYPE_SIZE;                                        \
 39     _down = _FP_W_TYPE_SIZE - _up;                                      \
 40     if (!_up)                                                           \
 41       for (_i = 7; _i >= _skip; --_i)                                   \
 42         X##_f[_i] = X##_f[_i-_skip];                                    \
 43     else                                                                \
 44       {                                                                 \
 45         for (_i = 7; _i > _skip; --_i)                                  \
 46           X##_f[_i] = X##_f[_i-_skip] << _up                            \
 47                       | X##_f[_i-_skip-1] >> _down;                     \
 48         X##_f[_i--] = X##_f[0] << _up;                                  \
 49       }                                                                 \
 50     for (; _i >= 0; --_i)                                               \
 51       X##_f[_i] = 0;                                                    \
 52   } while (0)
 53 
 54 #define _FP_FRAC_SRL_8(X,N)                                             \
 55   do {                                                                  \
 56     _FP_I_TYPE _up, _down, _skip, _i;                                   \
 57     _skip = (N) / _FP_W_TYPE_SIZE;                                      \
 58     _down = (N) % _FP_W_TYPE_SIZE;                                      \
 59     _up = _FP_W_TYPE_SIZE - _down;                                      \
 60     if (!_down)                                                         \
 61       for (_i = 0; _i <= 7-_skip; ++_i)                                 \
 62         X##_f[_i] = X##_f[_i+_skip];                                    \
 63     else                                                                \
 64       {                                                                 \
 65         for (_i = 0; _i < 7-_skip; ++_i)                                \
 66           X##_f[_i] = X##_f[_i+_skip] >> _down                          \
 67                       | X##_f[_i+_skip+1] << _up;                       \
 68         X##_f[_i++] = X##_f[7] >> _down;                                \
 69       }                                                                 \
 70     for (; _i < 8; ++_i)                                                \
 71       X##_f[_i] = 0;                                                    \
 72   } while (0)
 73 
 74 
 75 /* Right shift with sticky-lsb. 
 76  * What this actually means is that we do a standard right-shift,
 77  * but that if any of the bits that fall off the right hand side
 78  * were one then we always set the LSbit.
 79  */
 80 #define _FP_FRAC_SRS_8(X,N,size)                                        \
 81   do {                                                                  \
 82     _FP_I_TYPE _up, _down, _skip, _i;                                   \
 83     _FP_W_TYPE _s;                                                      \
 84     _skip = (N) / _FP_W_TYPE_SIZE;                                      \
 85     _down = (N) % _FP_W_TYPE_SIZE;                                      \
 86     _up = _FP_W_TYPE_SIZE - _down;                                      \
 87     for (_s = _i = 0; _i < _skip; ++_i)                                 \
 88       _s |= X##_f[_i];                                                  \
 89     _s |= X##_f[_i] << _up;                                             \
 90 /* s is now != 0 if we want to set the LSbit */                         \
 91     if (!_down)                                                         \
 92       for (_i = 0; _i <= 7-_skip; ++_i)                                 \
 93         X##_f[_i] = X##_f[_i+_skip];                                    \
 94     else                                                                \
 95       {                                                                 \
 96         for (_i = 0; _i < 7-_skip; ++_i)                                \
 97           X##_f[_i] = X##_f[_i+_skip] >> _down                          \
 98                       | X##_f[_i+_skip+1] << _up;                       \
 99         X##_f[_i++] = X##_f[7] >> _down;                                \
100       }                                                                 \
101     for (; _i < 8; ++_i)                                                \
102       X##_f[_i] = 0;                                                    \
103     /* don't fix the LSB until the very end when we're sure f[0] is stable */   \
104     X##_f[0] |= (_s != 0);                                              \
105   } while (0)
106 
107 #endif
108 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp