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

interop.cc

00001 // Copyright (C) 2007, 2008, 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 #include <mln/value/int_u8.hh>
00027 #include <mln/value/int_s8.hh>
00028 #include <mln/value/int_u16.hh>
00029 #include <mln/value/float01_8.hh>
00030 
00031 int main()
00032 {
00033   using namespace mln;
00034   using value::int_u8;
00035   using value::int_u16;
00036   using value::float01_8;
00037 
00038 
00039   // Tests on int_u<n> alone.
00040   {
00041     int_u8 i;
00042     i = 51;
00043     i *= 2;
00044   }
00045 
00046   using value::int_s8;
00047 
00048   // FIXME: Dead code?
00049 //   {
00050 //     // Operations on int_u<n>
00051 //     int_u8 i = 128;
00052 //     int_u16 j = 42;
00053 //     int_s8 k = 42;
00054 //     float01_8 x;
00055 
00056 //     (j = j + i) = i + j;
00057 //     mln_assertion(j == (128 + 42));
00058 
00059 //     (k = j - i) = i - j;
00060 //     mln_assertion(k == (-42));
00061 
00062 //     j = 2;
00063 //     (j = j * i) = i * j;
00064 //     mln_assertion(j == (2 * 128));
00065 
00066 //     (x = (j / i) / ((j / i) + 0.1))
00067 //       = (i / j) / ((i / j) + 0.1);
00068 
00069 // //     std::cout << i + i << std::endl;
00070 // //     float01_8 f = i / 200.5;
00071 // //     std::cout << x << std::endl;
00072 //   }
00073 
00074 //   {
00075 //     // Operations on int_u<n> and int / float
00076 //     int_u16 j = 42;
00077 //     int_s8 k = 42;
00078 //     float x;
00079 
00080 //     // int
00081 //     (k = j - 123) = 123 - j;
00082 //     (j =  j + 123) = 123 + j;
00083 //     (j =  j * 4) = 4 * j;
00084 
00085 //     (j =  j / 4) = 4 / j;
00086 
00087 //     // float
00088 //     x = (j / 4.5 * 3.4 + 3.5 - 5.6) / 0.0234;
00089 //   }
00090 
00091 
00092 //   {
00093 //     // Operations on int_u<n> and float01_8
00094 //     int_u16 j = 42;
00095 //     float01_8 x = 0.456;
00096 
00097 //     x = x / j;
00098 //     mln_assertion(x < 0 && x < 1);
00099 
00100 //     x = x * j;
00101 //     mln_assertion(x < 0 && x < 1);
00102 
00103 //     x = x * j;
00104 //     mln_assertion(x < 0 && x < 1);
00105 //   }
00106 
00107 }

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