Inferno  0.2
type_db.cpp
Go to the documentation of this file.
00001 #include "type_db.hpp"
00002 #include "llvm/ADT/APFloat.h"
00003 
00004 //
00005 // Initialise all the sizes and signednesses of integrals according to the 
00006 // current compiler - this is good for testing, when the same
00007 // compiler is used to compile generated output.
00008 //
00009 
00010 #define IS_SIGNED( T ) ((T)-1 < (T)0)
00011 
00012 const int TypeDb::char_bits = sizeof( char ) * 8;
00013 const bool TypeDb::int_default_signed = IS_SIGNED(int);
00014 const bool TypeDb::char_default_signed = IS_SIGNED(char);
00015 const unsigned TypeDb::integral_bits[] =
00016 {
00017     sizeof( int ) * 8,
00018     sizeof( short ) * 8,
00019     sizeof( long ) * 8,
00020     sizeof( long long ) * 8
00021 };
00022 
00023 //
00024 // Use IEEE standards for floats since reflection is too hard
00025 //
00026 const llvm::fltSemantics * const TypeDb::float_semantics = &llvm::APFloat::IEEEsingle;
00027 const llvm::fltSemantics * const TypeDb::double_semantics = &llvm::APFloat::IEEEdouble;
00028 const llvm::fltSemantics * const TypeDb::long_double_semantics = &llvm::APFloat::IEEEquad;