/usr/include/vigra/sized_int.hxx is in libvigraimpex-dev 1.10.0+dfsg-3ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | /************************************************************************/
/* */
/* Copyright 1998-2002 by Ullrich Koethe */
/* */
/* This file is part of the VIGRA computer vision library. */
/* The VIGRA Website is */
/* http://hci.iwr.uni-heidelberg.de/vigra/ */
/* Please direct questions, bug reports, and contributions to */
/* ullrich.koethe@iwr.uni-heidelberg.de or */
/* vigra@informatik.uni-hamburg.de */
/* */
/* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */
/* copy, modify, merge, publish, distribute, sublicense, and/or */
/* sell copies of the Software, and to permit persons to whom the */
/* Software is furnished to do so, subject to the following */
/* conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the */
/* Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */
/* */
/************************************************************************/
#ifndef VIGRA_SIZED_INT_HXX
#define VIGRA_SIZED_INT_HXX
#include "metaprogramming.hxx"
#include <limits>
#if SHRT_MAX == 0x7FL
# define VIGRA_BITSOF_SHORT 8
#elif SHRT_MAX == 0x7FFFL
# define VIGRA_BITSOF_SHORT 16
#elif SHRT_MAX == 0x7FFFFFFFL
# define VIGRA_BITSOF_SHORT 32
#elif SHRT_MAX > 0xFFFFFFFFL
# define VIGRA_BITSOF_SHORT 64
#else
# define VIGRA_BITSOF_SHORT -1
#endif
#if INT_MAX == 0x7FL
# define VIGRA_BITSOF_INT 8
#elif INT_MAX == 0x7FFFL
# define VIGRA_BITSOF_INT 16
#elif INT_MAX == 0x7FFFFFFFL
# define VIGRA_BITSOF_INT 32
#elif INT_MAX > 0xFFFFFFFFL
# define VIGRA_BITSOF_INT 64
#else
# define VIGRA_BITSOF_INT -1
#endif
#if LONG_MAX == 0x7FL
# define VIGRA_BITSOF_LONG 8
#elif LONG_MAX == 0x7FFFL
# define VIGRA_BITSOF_LONG 16
#elif LONG_MAX == 0x7FFFFFFFL
# define VIGRA_BITSOF_LONG 32
#elif LONG_MAX > 0xFFFFFFFFL
# define VIGRA_BITSOF_LONG 64
#else
# define VIGRA_BITSOF_LONG -1
#endif
#if LLONG_MAX == 0x7FL
# define VIGRA_BITSOF_LONG_LONG 8
#elif LLONG_MAX == 0x7FFFL
# define VIGRA_BITSOF_LONG_LONG 16
#elif LLONG_MAX == 0x7FFFFFFFL
# define VIGRA_BITSOF_LONG_LONG 32
#elif LLONG_MAX > 0xFFFFFFFFL
# define VIGRA_BITSOF_LONG_LONG 64
#else
# define VIGRA_BITSOF_LONG_LONG -1
#endif
namespace vigra {
class Int_type_not_supported_on_this_platform {};
#ifndef NO_PARTIAL_TEMPLATE_SPECIALIZATION
namespace detail {
template<class T, class NEXT>
struct IntTypeList
{
enum { size = sizeof(T)*8 };
typedef T type;
typedef NEXT next;
};
template<int SIZE, class LIST>
struct SelectIntegerType
{
typedef typename
IfBool<(SIZE == LIST::size),
typename LIST::type,
typename SelectIntegerType<SIZE, typename LIST::next>::type >::type
type;
};
template<int SIZE>
struct SelectIntegerType<SIZE, Int_type_not_supported_on_this_platform>
{
typedef Int_type_not_supported_on_this_platform type;
};
template<class LIST>
struct SelectBiggestIntegerType
{
enum { cursize = static_cast<int>(LIST::size),
nextsize = static_cast<int>(SelectBiggestIntegerType<typename LIST::next>::size),
size = (cursize < nextsize) ? nextsize : cursize };
typedef typename
IfBool<(cursize < nextsize),
typename SelectBiggestIntegerType<typename LIST::next>::type,
typename LIST::type>::type
type;
};
template<>
struct SelectBiggestIntegerType<Int_type_not_supported_on_this_platform>
{
enum { size = 0 };
typedef Int_type_not_supported_on_this_platform type;
};
typedef IntTypeList<signed char,
IntTypeList<signed short,
IntTypeList<signed int,
IntTypeList<signed long,
IntTypeList<signed long long,
Int_type_not_supported_on_this_platform > > > > > SignedIntTypes;
typedef IntTypeList<unsigned char,
IntTypeList<unsigned short,
IntTypeList<unsigned int,
IntTypeList<unsigned long,
IntTypeList<unsigned long long,
Int_type_not_supported_on_this_platform > > > > > UnsignedIntTypes;
} // namespace detail
/** \addtogroup FixedSizeInt Fixed Size Integer Types
Since the C++ standard does only specify minimal sizes for the built-in
integer types, one cannot rely on them to have a specific size. But
pixel types with a specific size are often required in image processing,
especially when reading or writing binary files. The VIGRA typedefs
are guaranteed to have exactly the correct size. If the system
does not provide a suitable type, the typedef will evaluate to
<tt>Int_type_not_supported_on_this_platform</tt>.
*/
//@{
/// 8-bit signed int
typedef detail::SelectIntegerType<8, detail::SignedIntTypes>::type Int8;
/// 16-bit signed int
typedef detail::SelectIntegerType<16, detail::SignedIntTypes>::type Int16;
/// 32-bit signed int
typedef detail::SelectIntegerType<32, detail::SignedIntTypes>::type Int32;
/// 64-bit signed int
typedef detail::SelectIntegerType<64, detail::SignedIntTypes>::type Int64;
/// 8-bit unsigned int
typedef detail::SelectIntegerType<8, detail::UnsignedIntTypes>::type UInt8;
/// 16-bit unsigned int
typedef detail::SelectIntegerType<16, detail::UnsignedIntTypes>::type UInt16;
/// 32-bit unsigned int
typedef detail::SelectIntegerType<32, detail::UnsignedIntTypes>::type UInt32;
/// 64-bit unsigned int
typedef detail::SelectIntegerType<64, detail::UnsignedIntTypes>::type UInt64;
/// the biggest signed integer type of the system
typedef detail::SelectBiggestIntegerType<detail::SignedIntTypes>::type IntBiggest;
/// the biggest unsigned integer type of the system
typedef detail::SelectBiggestIntegerType<detail::UnsignedIntTypes>::type UIntBiggest;
//@}
#else // NO_PARTIAL_TEMPLATE_SPECIALIZATION
typedef signed char Int8;
typedef signed short Int16;
typedef signed int Int32;
typedef Int_type_not_supported_on_this_platform Int64;
typedef unsigned char UInt8;
typedef unsigned short UInt16;
typedef unsigned int UInt32;
typedef Int_type_not_supported_on_this_platform UInt64;
typedef Int32 IntBiggest;
typedef UInt32 UIntBiggest;
#endif // NO_PARTIAL_TEMPLATE_SPECIALIZATION
} // namespace vigra
#endif /* VIGRA_SIZED_INT_HXX */
|