BWAPI
|
00001 // Copyright (c) 1999-2005 Utrecht University (The Netherlands), 00002 // ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), 00003 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg 00004 // (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), 00005 // and Tel-Aviv University (Israel). All rights reserved. 00006 // 00007 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00008 // modify it under the terms of the GNU Lesser General Public License as 00009 // published by the Free Software Foundation; version 2.1 of the License. 00010 // See the file LICENSE.LGPL distributed with CGAL. 00011 // 00012 // Licensees holding a valid commercial license may use this file in 00013 // accordance with the commercial license agreement provided with the software. 00014 // 00015 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 // 00018 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Number_types/include/CGAL/known_bit_size_integers.h $ 00019 // $Id: known_bit_size_integers.h 41714 2008-01-20 20:24:20Z spion $ 00020 // 00021 // 00022 // Author(s) : Lutz Kettner, Sylvain Pion 00023 00024 #ifndef CGAL_KNOWN_BIT_SIZE_INTEGERS_H 00025 #define CGAL_KNOWN_BIT_SIZE_INTEGERS_H 00026 00027 #include <CGAL/number_type_basic.h> 00028 #include <boost/mpl/if.hpp> 00029 00030 CGAL_BEGIN_NAMESPACE 00031 00032 namespace CGALi { 00033 00034 namespace mpl = boost::mpl; 00035 00036 template < int size > 00037 struct No_Integer_Type_Of_Size; 00038 00039 // Provides a signed integral type whose sizeof() is s. 00040 // If not possible, gives No_Integer_Type_Of_Size<s>. 00041 template < int s > 00042 struct SizeofSelect 00043 { 00044 typedef typename mpl::if_c< (sizeof(signed char) == s), signed char, 00045 typename mpl::if_c< (sizeof(short) == s), short, 00046 typename mpl::if_c< (sizeof(int) == s), int, 00047 typename mpl::if_c< (sizeof(long) == s), long, 00048 No_Integer_Type_Of_Size<s> >::type >::type >::type >::type Type; 00049 }; 00050 00051 // Same thing for unsigned types. 00052 template < int s > 00053 struct USizeofSelect 00054 { 00055 typedef typename mpl::if_c< (sizeof(unsigned char) == s), unsigned char, 00056 typename mpl::if_c< (sizeof(unsigned short) ==s), unsigned short, 00057 typename mpl::if_c< (sizeof(unsigned int) == s), unsigned int, 00058 typename mpl::if_c< (sizeof(unsigned long) == s), 00059 unsigned long, 00060 No_Integer_Type_Of_Size<s> >::type >::type >::type >::type Type; 00061 }; 00062 00063 } // namespace CGALi 00064 00065 00066 typedef CGALi::SizeofSelect<1>::Type Integer8; 00067 typedef CGALi::SizeofSelect<2>::Type Integer16; 00068 typedef CGALi::SizeofSelect<4>::Type Integer32; 00069 00070 typedef CGALi::USizeofSelect<1>::Type UInteger8; 00071 typedef CGALi::USizeofSelect<2>::Type UInteger16; 00072 typedef CGALi::USizeofSelect<4>::Type UInteger32; 00073 00074 #if defined __ia64__ || defined __x86_64 00075 typedef long Integer64; 00076 typedef unsigned long UInteger64; 00077 # define CGAL_HAS_INTEGER64 00078 #endif 00079 00080 #if defined _MSC_VER 00081 typedef __int64 Integer64; 00082 typedef unsigned __int64 UInteger64; 00083 # define CGAL_HAS_INTEGER64 00084 #endif 00085 00086 // 64 integer types are defined for other platforms in CGAL/long_long.h 00087 00088 CGAL_END_NAMESPACE 00089 00090 #endif // CGAL_KNOWN_BIT_SIZE_INTEGERS_H