CMS 3D CMS Logo

IntBits.h

Go to the documentation of this file.
00001 #ifndef CLASSLIB_INT_BITS_H
00002 # define CLASSLIB_INT_BITS_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "classlib/utils/BitTraits.h"
00007 # include "classlib/sysapi/nonstdint.h"
00008 
00009 namespace lat {
00010 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00011 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00012 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00013 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00014 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00015 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00016 
00018 template <unsigned int N>
00019 struct IntBits
00020 {
00021     // `UExact' and `SExact' are defined only for the actual types
00022     typedef typename IntBits<N+1>::UFast        UFast;
00023     typedef typename IntBits<N+1>::SFast        SFast;
00024     typedef typename IntBits<N+1>::ULeast       ULeast;
00025     typedef typename IntBits<N+1>::SLeast       SLeast;
00026 };
00027 
00028 # if defined CLASSLIB_INT8_MAX
00029 template <>
00030 struct IntBits<8>
00031 {
00032     static const unsigned int   Bits = 8;
00033 
00034     typedef int8_t              SExact;
00035     typedef uint8_t             UExact;
00036 
00037     typedef int_least8_t        SLeast;
00038     typedef uint_least8_t       ULeast;
00039 
00040     typedef int_fast8_t         SFast;
00041     typedef uint_fast8_t        UFast;
00042 };
00043 # endif
00044 
00045 # if defined CLASSLIB_INT16_MAX
00046 template <>
00047 struct IntBits<16>
00048 {
00049     static const unsigned int   Bits = 16;
00050 
00051     typedef int16_t             SExact;
00052     typedef uint16_t            UExact;
00053 
00054     typedef int_least16_t       SLeast;
00055     typedef uint_least16_t      ULeast;
00056 
00057     typedef int_fast16_t        SFast;
00058     typedef uint_fast16_t       UFast;
00059 };
00060 # endif
00061 
00062 # if defined CLASSLIB_INT32_MAX
00063 template <>
00064 struct IntBits<32>
00065 {
00066     static const unsigned int   Bits = 32;
00067 
00068     typedef int32_t             SExact;
00069     typedef uint32_t            UExact;
00070 
00071     typedef int_least32_t       SLeast;
00072     typedef uint_least32_t      ULeast;
00073 
00074     typedef int_fast32_t        SFast;
00075     typedef uint_fast32_t       UFast;
00076 };
00077 # endif
00078 
00079 # if defined CLASSLIB_INT64_MAX
00080 template <>
00081 struct IntBits<64>
00082 {
00083     static const unsigned int   Bits = 64;
00084 
00085     typedef int64_t             SExact;
00086     typedef uint64_t            UExact;
00087 
00088     typedef int_least64_t       SLeast;
00089     typedef uint_least64_t      ULeast;
00090 
00091     typedef int_fast64_t        SFast;
00092     typedef uint_fast64_t       UFast;
00093 };
00094 # endif
00095 
00096 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00097 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00098 
00099 } // namespace lat
00100 #endif // CLASSLIB_INT_BITS_H

Generated on Tue Jun 9 17:38:54 2009 for CMSSW by  doxygen 1.5.4