<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>scint.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Mon Oct 14 14:16:38 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>scint.h</h1><div class="fragment"><pre>00001 <font class="comment">// This provides C99-like standard integer types. It is based on boost.org</font> 00002 <font class="comment">// code which has been modified for inclusion in the SC Toolkit.</font> 00003 00004 <font class="comment">// (C) Copyright boost.org 1999. Permission to copy, use, modify, sell</font> 00005 <font class="comment">// and distribute this software is granted provided this copyright</font> 00006 <font class="comment">// notice appears in all copies. This software is provided "as is" without</font> 00007 <font class="comment">// express or implied warranty, and with no claim as to its suitability for</font> 00008 <font class="comment">// any purpose.</font> 00009 00010 <font class="preprocessor">#ifndef util_misc_scint_h</font> 00011 <font class="preprocessor"></font><font class="preprocessor">#define util_misc_scint_h</font> 00012 <font class="preprocessor"></font> 00013 <font class="preprocessor">#ifdef HAVE_STDINT_H</font> 00014 <font class="preprocessor"></font> 00015 <font class="preprocessor">#include <stdint.h></font> 00016 00017 <font class="keyword">namespace </font>sc { 00018 00019 <font class="keyword">typedef</font> int8_t sc_int8_t; 00020 <font class="keyword">typedef</font> int_least8_t sc_int_least8_t; 00021 <font class="keyword">typedef</font> int_fast8_t sc_int_fast8_t; 00022 <font class="keyword">typedef</font> uint8_t sc_uint8_t; 00023 <font class="keyword">typedef</font> uint_least8_t sc_uint_least8_t; 00024 <font class="keyword">typedef</font> uint_fast8_t sc_uint_fast8_t; 00025 00026 <font class="keyword">typedef</font> int16_t sc_int16_t; 00027 <font class="keyword">typedef</font> int_least16_t sc_int_least16_t; 00028 <font class="keyword">typedef</font> int_fast16_t sc_int_fast16_t; 00029 <font class="keyword">typedef</font> uint16_t sc_uint16_t; 00030 <font class="keyword">typedef</font> uint_least16_t sc_uint_least16_t; 00031 <font class="keyword">typedef</font> uint_fast16_t sc_uint_fast16_t; 00032 00033 <font class="keyword">typedef</font> int32_t sc_int32_t; 00034 <font class="keyword">typedef</font> int_least32_t sc_int_least32_t; 00035 <font class="keyword">typedef</font> int_fast32_t sc_int_fast32_t; 00036 <font class="keyword">typedef</font> uint32_t sc_uint32_t; 00037 <font class="keyword">typedef</font> uint_least32_t sc_uint_least32_t; 00038 <font class="keyword">typedef</font> uint_fast32_t sc_uint_fast32_t; 00039 00040 <font class="keyword">typedef</font> intmax_t sc_intmax_t; 00041 <font class="keyword">typedef</font> uintmax_t sc_uintmax_t; 00042 <font class="keyword">typedef</font> int64_t sc_int64_t; 00043 <font class="keyword">typedef</font> int_least64_t sc_int_least64_t; 00044 <font class="keyword">typedef</font> int_fast64_t sc_int_fast64_t; 00045 <font class="keyword">typedef</font> uint64_t sc_uint64_t; 00046 <font class="keyword">typedef</font> uint_least64_t sc_uint_least64_t; 00047 <font class="keyword">typedef</font> uint_fast64_t sc_uint_fast64_t; 00048 00049 } 00050 00051 <font class="preprocessor">#else</font> 00052 <font class="preprocessor"></font> 00053 <font class="comment">// This is not a complete implementation of the 1999 C Standard stdint.h</font> 00054 <font class="comment">// header; it doesn't supply various macros which are not advisable for use in</font> 00055 <font class="comment">// C++ programs.</font> 00056 00057 <font class="preprocessor">#include <limits.h></font> <font class="comment">// implementation artifact; not part of interface</font> 00058 00059 <font class="keyword">namespace </font>sc { 00060 00061 <font class="comment">// These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit</font> 00062 <font class="comment">// platforms. For other systems, they will have to be hand tailored.</font> 00063 <font class="comment">// Because the fast types are assumed to be the same as the undecorated types,</font> 00064 <font class="comment">// it may be possible to hand tailor a more efficient implementation.</font> 00065 00066 <font class="comment">// 8-bit types -------------------------------------------------------------//</font> 00067 00068 <font class="preprocessor"># if UCHAR_MAX == 0xff</font> 00069 <font class="preprocessor"></font> <font class="keyword">typedef</font> <font class="keywordtype">signed</font> <font class="keywordtype">char</font> sc_int8_t; 00070 <font class="keyword">typedef</font> <font class="keywordtype">signed</font> <font class="keywordtype">char</font> sc_int_least8_t; 00071 <font class="keyword">typedef</font> <font class="keywordtype">signed</font> <font class="keywordtype">char</font> sc_int_fast8_t; 00072 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> sc_uint8_t; 00073 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> sc_uint_least8_t; 00074 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> sc_uint_fast8_t; 00075 <font class="preprocessor"># else</font> 00076 <font class="preprocessor"></font><font class="preprocessor"># error defaults not correct; you must hand modify scint.h</font> 00077 <font class="preprocessor"></font><font class="preprocessor"># endif</font> 00078 <font class="preprocessor"></font> 00079 <font class="comment">// 16-bit types ------------------------------------------------------------//</font> 00080 00081 <font class="preprocessor"># if USHRT_MAX == 0xffff</font> 00082 <font class="preprocessor"></font> <font class="keyword">typedef</font> <font class="keywordtype">short</font> sc_int16_t; 00083 <font class="keyword">typedef</font> <font class="keywordtype">short</font> sc_int_least16_t; 00084 <font class="keyword">typedef</font> <font class="keywordtype">short</font> sc_int_fast16_t; 00085 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">short</font> sc_uint16_t; 00086 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">short</font> sc_uint_least16_t; 00087 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">short</font> sc_uint_fast16_t; 00088 <font class="preprocessor"># else</font> 00089 <font class="preprocessor"></font><font class="preprocessor"># error defaults not correct; you must hand modify scint.h</font> 00090 <font class="preprocessor"></font><font class="preprocessor"># endif</font> 00091 <font class="preprocessor"></font> 00092 <font class="comment">// 32-bit types ------------------------------------------------------------//</font> 00093 00094 <font class="preprocessor"># if UINT_MAX == 0xffffffff</font> 00095 <font class="preprocessor"></font> <font class="keyword">typedef</font> <font class="keywordtype">int</font> sc_int32_t; 00096 <font class="keyword">typedef</font> <font class="keywordtype">int</font> sc_int_least32_t; 00097 <font class="keyword">typedef</font> <font class="keywordtype">int</font> sc_int_fast32_t; 00098 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> sc_uint32_t; 00099 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> sc_uint_least32_t; 00100 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> sc_uint_fast32_t; 00101 <font class="preprocessor"># elif ULONG_MAX == 0xffffffff</font> 00102 <font class="preprocessor"></font> <font class="keyword">typedef</font> <font class="keywordtype">long</font> sc_int32_t; 00103 <font class="keyword">typedef</font> <font class="keywordtype">long</font> sc_int_least32_t; 00104 <font class="keyword">typedef</font> <font class="keywordtype">long</font> sc_int_fast32_t; 00105 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> sc_uint32_t; 00106 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> sc_uint_least32_t; 00107 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> sc_uint_fast32_t; 00108 <font class="preprocessor"># else</font> 00109 <font class="preprocessor"></font><font class="preprocessor"># error defaults not correct; you must hand modify scint.h</font> 00110 <font class="preprocessor"></font><font class="preprocessor"># endif</font> 00111 <font class="preprocessor"></font> 00112 <font class="comment">// 64-bit types + intmax_t and uintmax_t -----------------------------------//</font> 00113 00114 <font class="preprocessor">#if defined(ULONGLONG_MAX) && !defined(ULLONG_MAX)</font> 00115 <font class="preprocessor"></font><font class="preprocessor"># define ULLONG_MAX ULONGLONG_MAX</font> 00116 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00117 <font class="preprocessor"></font> 00118 <font class="preprocessor"># ifdef ULLONG_MAX</font> 00119 <font class="preprocessor"></font><font class="comment">//# if ULLONG_MAX == 18446744073709551615 // 2**64 - 1</font> 00120 <font class="preprocessor"># if ULONGLONG_MAX == (0xffffffffffffffffuLL) // uLL reqd for xlC</font> 00121 <font class="preprocessor"></font> <font class="keyword">typedef</font> <font class="keywordtype">long</font> <font class="keywordtype">long</font> sc_intmax_t; 00122 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> <font class="keywordtype">long</font> sc_uintmax_t; 00123 <font class="keyword">typedef</font> <font class="keywordtype">long</font> <font class="keywordtype">long</font> sc_int64_t; 00124 <font class="keyword">typedef</font> <font class="keywordtype">long</font> <font class="keywordtype">long</font> sc_int_least64_t; 00125 <font class="keyword">typedef</font> <font class="keywordtype">long</font> <font class="keywordtype">long</font> sc_int_fast64_t; 00126 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> <font class="keywordtype">long</font> sc_uint64_t; 00127 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> <font class="keywordtype">long</font> sc_uint_least64_t; 00128 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> <font class="keywordtype">long</font> sc_uint_fast64_t; 00129 <font class="preprocessor"># else</font> 00130 <font class="preprocessor"></font><font class="preprocessor"># error defaults not correct; you must hand modify scint.h</font> 00131 <font class="preprocessor"></font><font class="preprocessor"># endif</font> 00132 <font class="preprocessor"></font><font class="preprocessor"># elif ULONG_MAX != 0xffffffff</font> 00133 <font class="preprocessor"></font> 00134 <font class="preprocessor"># if ULONG_MAX == 18446744073709551615 // 2**64 - 1</font> 00135 <font class="preprocessor"></font> <font class="keyword">typedef</font> <font class="keywordtype">long</font> sc_intmax_t; 00136 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> sc_uintmax_t; 00137 <font class="keyword">typedef</font> <font class="keywordtype">long</font> sc_int64_t; 00138 <font class="keyword">typedef</font> <font class="keywordtype">long</font> sc_int_least64_t; 00139 <font class="keyword">typedef</font> <font class="keywordtype">long</font> sc_int_fast64_t; 00140 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> sc_uint64_t; 00141 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> sc_uint_least64_t; 00142 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> sc_uint_fast64_t; 00143 <font class="preprocessor"># else</font> 00144 <font class="preprocessor"></font><font class="preprocessor"># error defaults not correct; you must hand modify scint.h</font> 00145 <font class="preprocessor"></font><font class="preprocessor"># endif</font> 00146 <font class="preprocessor"></font><font class="preprocessor"># else // assume no 64-bit integers</font> 00147 <font class="preprocessor"></font><font class="preprocessor"># error 64 bit integer types are required</font> 00148 <font class="preprocessor"></font> <font class="keyword">typedef</font> sc_int32_t sc_intmax_t; 00149 <font class="keyword">typedef</font> sc_uint32_t sc_uintmax_t; 00150 <font class="preprocessor"># endif</font> 00151 <font class="preprocessor"></font> 00152 } 00153 00154 <font class="preprocessor">#endif</font> 00155 <font class="preprocessor"></font> 00156 <font class="preprocessor">#endif</font> </font></div></pre><hr> <address> <small> Generated at Mon Oct 14 14:16:38 2002 for <a href="http://aros.ca.sandia.gov/~cljanss/mpqc">MPQC</a> 2.1.2 using the documentation package <a href="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</a> 1.2.5. </small> </address> </body> </html>