• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

promotions.hh

00001 // Copyright (C) 2006, 2007, 2009  EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
00025 
00026 #ifndef MLN_VALUE_BUILTIN_PROMOTIONS_HH
00027 # define MLN_VALUE_BUILTIN_PROMOTIONS_HH
00028 
00034 # include <mln/trait/promote.hh>
00035 # include <mln/metal/ret.hh>
00036 
00037 
00038 # define mln_internal_set_promotion_(Builtin1, Builtin2, Result)        \
00039                                                                         \
00040   template<>                                                            \
00041   struct set_precise_binary_< promote, Builtin1, Builtin2 >             \
00042   {                                                                     \
00043     typedef Result ret;                                                 \
00044   };                                                                    \
00045                                                                         \
00046   struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_u_m_n                            \
00047 
00048 
00049 # define mln_internal_set_promotion_auto_(From, To)     \
00050                                                         \
00051   mln_internal_set_promotion_(From, To, To);            \
00052   mln_internal_set_promotion_(To, From, To);            \
00053   struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_u_m_n
00054 
00055 
00056 # define mln_internal_set_promotion_twice_(From, To)    \
00057                                                         \
00058   mln_internal_set_promotion_(From, From, To);          \
00059   struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_u_m_n
00060 
00061 
00062 # define mln_internal_set_promotion_bi_(From1, From2, To)       \
00063                                                                 \
00064   mln_internal_set_promotion_(From1, From2, To);                \
00065   mln_internal_set_promotion_(From2, From1, To);                \
00066   struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_u_m_n
00067 
00068 
00069 
00070 namespace mln
00071 {
00072 
00073   // Fwd decl.
00074   namespace value { template <typename B> struct Built_In; }
00075 
00076 
00077   namespace trait
00078   {
00079 
00080     // Builtin binary traits.
00081 
00082 
00083     mln_internal_set_promotion_bi_(unsigned char,  signed char,  int);
00084     mln_internal_set_promotion_bi_(unsigned short, signed char,  int);
00085     mln_internal_set_promotion_bi_(unsigned int,   signed char,  int);
00086     mln_internal_set_promotion_bi_(unsigned long,  signed char,  long);
00087 
00088     mln_internal_set_promotion_bi_(unsigned short, signed short, int);
00089     mln_internal_set_promotion_bi_(unsigned int,   signed short, int);
00090     mln_internal_set_promotion_bi_(unsigned long,  signed short, long);
00091 
00092     mln_internal_set_promotion_bi_(unsigned long,  signed int,   long);
00093 
00094 
00095     mln_internal_set_promotion_twice_(unsigned char,  unsigned);
00096     mln_internal_set_promotion_twice_(  signed char,  int);
00097     mln_internal_set_promotion_twice_(unsigned short, unsigned);
00098     mln_internal_set_promotion_twice_(  signed short, int);
00099     mln_internal_set_promotion_twice_(unsigned int,   unsigned);
00100     mln_internal_set_promotion_twice_(  signed int,   int);
00101     mln_internal_set_promotion_twice_(unsigned long,  unsigned long);
00102     mln_internal_set_promotion_twice_(  signed long,  long);
00103 
00104     mln_internal_set_promotion_twice_(   float,       float);
00105     mln_internal_set_promotion_twice_(  double,       double);
00106 
00107 
00108     mln_internal_set_promotion_auto_(unsigned char,  unsigned short);
00109     mln_internal_set_promotion_auto_(unsigned char,    signed short);
00110     mln_internal_set_promotion_auto_(  signed char,    signed short);
00111 
00112     mln_internal_set_promotion_auto_(unsigned char,  unsigned int);
00113     mln_internal_set_promotion_auto_(unsigned char,    signed int);
00114     mln_internal_set_promotion_auto_(  signed char,    signed int);
00115     mln_internal_set_promotion_auto_(unsigned short, unsigned int);
00116     mln_internal_set_promotion_auto_(unsigned short,   signed int);
00117     mln_internal_set_promotion_auto_(  signed short,   signed int);
00118     mln_internal_set_promotion_auto_(unsigned int,     signed int);
00119 
00120     mln_internal_set_promotion_auto_(unsigned char,  unsigned long);
00121     mln_internal_set_promotion_auto_(unsigned char,    signed long);
00122     mln_internal_set_promotion_auto_(  signed char,    signed long);
00123     mln_internal_set_promotion_auto_(unsigned short, unsigned long);
00124     mln_internal_set_promotion_auto_(unsigned short,   signed long);
00125     mln_internal_set_promotion_auto_(  signed short,   signed long);
00126     mln_internal_set_promotion_auto_(unsigned int,   unsigned long);
00127     mln_internal_set_promotion_auto_(unsigned int,     signed long);
00128     mln_internal_set_promotion_auto_(  signed int,     signed long);
00129 
00130     mln_internal_set_promotion_auto_(unsigned char,  float);
00131     mln_internal_set_promotion_auto_(  signed char,  float);
00132     mln_internal_set_promotion_auto_(unsigned short, float);
00133     mln_internal_set_promotion_auto_(  signed short, float);
00134     mln_internal_set_promotion_auto_(unsigned int,   float);
00135     mln_internal_set_promotion_auto_(  signed int,   float);
00136     mln_internal_set_promotion_auto_(unsigned long,  float);
00137     mln_internal_set_promotion_auto_(  signed long,  float);
00138 
00139     mln_internal_set_promotion_auto_(unsigned char,  double);
00140     mln_internal_set_promotion_auto_(  signed char,  double);
00141     mln_internal_set_promotion_auto_(unsigned short, double);
00142     mln_internal_set_promotion_auto_(  signed short, double);
00143     mln_internal_set_promotion_auto_(unsigned int,   double);
00144     mln_internal_set_promotion_auto_(  signed int,   double);
00145     mln_internal_set_promotion_auto_(unsigned long,  double);
00146     mln_internal_set_promotion_auto_(  signed long,  double);
00147 
00148     mln_internal_set_promotion_auto_(   float,       double);
00149 
00150   } // end of namespace mln::trait
00151 
00152 } // end of namespace mln
00153 
00154 
00155 #endif // ! MLN_VALUE_BUILTIN_PROMOTIONS_HH

Generated on Tue Oct 4 2011 15:24:20 for Milena (Olena) by  doxygen 1.7.1