<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>scs_private.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.2.15 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center> <hr><h1>scs_private.h</h1><a href="scs__private_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/** Various declarations and macros shared by</font> 00002 <font class="comment"> several .c files, but useless to users of the library </font> 00003 <font class="comment"></font> 00004 <font class="comment"> @file scs_private.h</font> 00005 <font class="comment"></font> 00006 <font class="comment">@author Defour David David.Defour@ens-lyon.fr</font> 00007 <font class="comment">@author Florent de Dinechin Florent.de.Dinechin@ens-lyon.fr </font> 00008 <font class="comment">*/</font> 00009 00010 00011 <font class="comment">/*</font> 00012 <font class="comment">Copyright (C) 2002 David Defour and Florent de Dinechin</font> 00013 <font class="comment"></font> 00014 <font class="comment"> This library is free software; you can redistribute it and/or</font> 00015 <font class="comment"> modify it under the terms of the GNU Lesser General Public</font> 00016 <font class="comment"> License as published by the Free Software Foundation; either</font> 00017 <font class="comment"> version 2.1 of the License, or (at your option) any later version.</font> 00018 <font class="comment"></font> 00019 <font class="comment"> This library is distributed in the hope that it will be useful,</font> 00020 <font class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00021 <font class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> 00022 <font class="comment"> Lesser General Public License for more details.</font> 00023 <font class="comment"></font> 00024 <font class="comment"> You should have received a copy of the GNU Lesser General Public</font> 00025 <font class="comment"> License along with this library; if not, write to the Free Software</font> 00026 <font class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</font> 00027 <font class="comment"></font> 00028 <font class="comment"> */</font> 00029 <font class="preprocessor">#ifndef SCS_PRIVATE_H</font> 00030 <font class="preprocessor"></font><font class="preprocessor">#define SCS_PRIVATE_H 1</font> 00031 <font class="preprocessor"></font> 00032 00033 <font class="preprocessor">#define SCS_RADIX (1<<SCS_NB_BITS)</font> 00034 <font class="preprocessor"></font> 00035 <font class="preprocessor">#define SCS_MASK_RADIX ((unsigned int)(SCS_RADIX-1))</font> 00036 <font class="preprocessor"></font> 00037 <font class="preprocessor">#include "<a class="code" href="scs_8h.html">scs.h</a>"</font> 00038 00039 <font class="preprocessor">#ifdef WORDS_BIGENDIAN</font> 00040 <font class="preprocessor"></font><font class="preprocessor"> #define HI_ENDIAN 0</font> 00041 <font class="preprocessor"></font><font class="preprocessor"> #define LO_ENDIAN 1 </font> 00042 <font class="preprocessor"></font><font class="preprocessor">#else</font> 00043 <font class="preprocessor"></font><font class="preprocessor"> #define HI_ENDIAN 1</font> 00044 <font class="preprocessor"></font><font class="preprocessor"> #define LO_ENDIAN 0</font> 00045 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00046 <font class="preprocessor"></font> 00047 <font class="comment">/* An int such that SCS_MAX_RANGE * SCS_NB_BITS < 1024, </font> 00048 <font class="comment"> where 1024 is the max of the exponent of a double number.</font> 00049 <font class="comment"> Used in scs2double.c along with radix_rng_double et al. </font> 00050 <font class="comment"> The value of 32 is OK for all practical values of SCS_NB_BITS */</font> 00051 <font class="preprocessor">#define SCS_MAX_RANGE 32</font> 00052 <font class="preprocessor"></font> 00053 <font class="comment">/*</font> 00054 <font class="comment"> * DEFINITION OF DOUBLE PRECISION FLOATING POINT NUMBER CONSTANTS </font> 00055 <font class="comment"> */</font> 00056 <font class="comment">/* In all the following "radix" means 2^(SCS_NB_BITS),</font> 00057 <font class="comment"> and radix_blah means radix^blah.</font> 00058 <font class="comment"> (1023 + e)<<20 is the way to cast e into the exponent field of an IEEE-754 double</font> 00059 <font class="comment"> */</font> 00060 00061 <font class="preprocessor">#ifdef WORDS_BIGENDIAN</font> 00062 <font class="preprocessor"></font> <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_one_double = {{((1023+SCS_NB_BITS)<<20) , 0x00000000 }}; 00063 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_two_double = {{((1023+2*SCS_NB_BITS)<<20) , 0x00000000 }}; 00064 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_mone_double = {{((1023-SCS_NB_BITS)<<20) , 0x00000000 }}; 00065 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_mtwo_double = {{((1023-2*SCS_NB_BITS)<<20) , 0x00000000 }}; 00066 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_rng_double = {{((1023+SCS_NB_BITS*SCS_MAX_RANGE)<<20) , 0x00000000 }}; 00067 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_mrng_double = {{((1023-SCS_NB_BITS*SCS_MAX_RANGE)<<20) , 0x00000000 }}; 00068 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number max_double = {{0x7FEFFFFF , 0xFFFFFFFF }}; 00069 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number min_double = {{0x00000000 , 0x00000001 }}; 00070 <font class="preprocessor">#else</font> 00071 <font class="preprocessor"></font> <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_one_double = {{0x00000000 , ((1023+SCS_NB_BITS)<<20) }}; 00072 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_two_double = {{0x00000000 , ((1023+2*SCS_NB_BITS)<<20) }}; 00073 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_mone_double = {{0x00000000 , ((1023-SCS_NB_BITS)<<20) }}; 00074 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_mtwo_double = {{0x00000000 , ((1023-2*SCS_NB_BITS)<<20) }}; 00075 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_rng_double = {{0x00000000 , ((1023+SCS_NB_BITS*SCS_MAX_RANGE)<<20) }}; 00076 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number radix_mrng_double = {{0x00000000 , ((1023-SCS_NB_BITS*SCS_MAX_RANGE)<<20) }}; 00077 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number max_double = {{0xFFFFFFFF , 0x7FEFFFFF }}; 00078 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number min_double = {{0x00000001 , 0x00000000 }}; 00079 <font class="preprocessor"> #endif</font> 00080 <font class="preprocessor"></font> 00081 00082 <font class="preprocessor">#define SCS_RADIX_ONE_DOUBLE radix_one_double.d </font><font class="comment">/* 2^(SCS_NB_BITS) */</font> 00083 <font class="preprocessor">#define SCS_RADIX_TWO_DOUBLE radix_two_double.d </font><font class="comment">/* 2^(2.SCS_NB_BITS) */</font> 00084 <font class="preprocessor">#define SCS_RADIX_MONE_DOUBLE radix_mone_double.d </font><font class="comment">/* 2^-(SCS_NB_BITS) */</font> 00085 <font class="preprocessor">#define SCS_RADIX_MTWO_DOUBLE radix_mtwo_double.d </font><font class="comment">/* 2^-(2.SCS_NB_BITS) */</font> 00086 <font class="preprocessor">#define SCS_RADIX_RNG_DOUBLE radix_rng_double.d </font><font class="comment">/* 2^(SCS_NB_BITS.SCS_MAX_RANGE) */</font> 00087 <font class="preprocessor">#define SCS_RADIX_MRNG_DOUBLE radix_mrng_double.d </font><font class="comment">/* 2^-(SCS_NB_BITS.SCS_MAX_RANGE)*/</font> 00088 <font class="preprocessor">#define SCS_MAX_DOUBLE max_double.d </font><font class="comment">/* 2^1024-1 */</font> 00089 <font class="preprocessor">#define SCS_MIN_DOUBLE min_double.d </font><font class="comment">/* 2^-1074 */</font> 00090 00091 00092 00093 00094 00095 00096 <font class="preprocessor">#define R_HW result->h_word</font> 00097 <font class="preprocessor"></font><font class="preprocessor">#define R_SGN result->sign</font> 00098 <font class="preprocessor"></font><font class="preprocessor">#define R_IND result->index</font> 00099 <font class="preprocessor"></font><font class="preprocessor">#define R_EXP result->exception.d</font> 00100 <font class="preprocessor"></font> 00101 <font class="preprocessor">#define X_HW x->h_word</font> 00102 <font class="preprocessor"></font><font class="preprocessor">#define X_SGN x->sign</font> 00103 <font class="preprocessor"></font><font class="preprocessor">#define X_IND x->index</font> 00104 <font class="preprocessor"></font><font class="preprocessor">#define X_EXP x->exception.d</font> 00105 <font class="preprocessor"></font> 00106 <font class="preprocessor">#define Y_HW y->h_word</font> 00107 <font class="preprocessor"></font><font class="preprocessor">#define Y_SGN y->sign</font> 00108 <font class="preprocessor"></font><font class="preprocessor">#define Y_IND y->index</font> 00109 <font class="preprocessor"></font><font class="preprocessor">#define Y_EXP y->exception.d</font> 00110 <font class="preprocessor"></font> 00111 <font class="preprocessor">#define Z_HW z->h_word</font> 00112 <font class="preprocessor"></font><font class="preprocessor">#define Z_SGN z->sign</font> 00113 <font class="preprocessor"></font><font class="preprocessor">#define Z_IND z->index</font> 00114 <font class="preprocessor"></font><font class="preprocessor">#define Z_EXP z->exception.d</font> 00115 <font class="preprocessor"></font> 00116 <font class="preprocessor">#define W_HW w->h_word</font> 00117 <font class="preprocessor"></font><font class="preprocessor">#define W_SGN w->sign</font> 00118 <font class="preprocessor"></font><font class="preprocessor">#define W_IND w->index</font> 00119 <font class="preprocessor"></font><font class="preprocessor">#define W_EXP w->exception.d</font> 00120 <font class="preprocessor"></font> 00121 00122 00123 <font class="comment">/* A few additional defines for the case when we use floating-point</font> 00124 <font class="comment"> multiplier */</font> 00125 00126 <font class="preprocessor">#ifdef SCS_USE_FLT_MULT</font> 00127 <font class="preprocessor"></font><font class="comment">/* There is a "53" below, which means that these constants won't do</font> 00128 <font class="comment"> what we expect from them on x86 because of the double extended</font> 00129 <font class="comment"> precision. We could put more ifdefs, but why care, nobody wants to use the</font> 00130 <font class="comment"> FP muls on the x86. */</font> 00131 <font class="preprocessor">#ifdef WORDS_BIGENDIAN</font> 00132 <font class="preprocessor"></font> <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number scs_flt_trunc_cst = {{ ((1023+SCS_NB_BITS-1)<<20) , 0x00000000 }}; 00133 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number scs_flt_shift_cst = {{ ((1023+SCS_NB_BITS+53)<<20),0x00000000}}; 00134 <font class="preprocessor">#else</font> 00135 <font class="preprocessor"></font> <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number scs_flt_trunc_cst = {{ 0x00000000, ((1023+SCS_NB_BITS-1)<<20) }}; 00136 <font class="keyword">static</font> <font class="keyword">const</font> scs_db_number scs_flt_shift_cst = {{ 0x00000000 ,((1023+SCS_NB_BITS+53)<<20)}}; 00137 <font class="preprocessor">#endif </font><font class="comment">/*WORDS_BIGENDIAN*/</font> 00138 00139 <font class="preprocessor">#define SCS_FLT_TRUNC_CST scs_flt_trunc_cst.d </font><font class="comment">/* 2^(SCS_NB_BITS+53-1) */</font> 00140 <font class="preprocessor">#define SCS_FLT_SHIFT_CST scs_flt_shift_cst.d </font><font class="comment">/* 2^(SCS_NB_BITS)(1+1/2) */</font> 00141 <font class="preprocessor">#endif </font><font class="comment">/* SCS_USE_FLTMULT */</font> 00142 00143 <font class="preprocessor">#endif</font> </pre></div><hr><address align="right"><small>Generated on Tue Jun 17 10:15:51 2003 for SCSLib by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.15 </small></address> </body> </html>