This file is indexed.

/usr/include/fflas-ffpack/utils/flimits.h is in fflas-ffpack-common 2.2.2-5.

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
/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
// vim:sts=4:sw=4:ts=4:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
/*
 * Copyright (C) 2014 the FFLAS-FFPACK group
 *
 * Written by   <bastien.vialla@lirmm.fr>
 *
 *
 * ========LICENCE========
 * This file is part of the library FFLAS-FFPACK.
 *
 * FFLAS-FFPACK is free software: you can redistribute it and/or modify
 * it under the terms of the  GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * ========LICENCE========
 *.
 */

#ifndef __FFLASFFPACK_limits_H
#define __FFLASFFPACK_limits_H

//#include <cstddef>
#include <climits>
#include <limits>
#include <type_traits>

#include <givaro/givinteger.h>

template <class T> struct limits;
// {
//     constexpr inline static T max() noexcept {return 0;}
//     constexpr inline static T min() noexcept {return 0;}
// };

template <> struct limits<unsigned char> {
	typedef unsigned char T ;
	constexpr inline static unsigned char max() noexcept {return UCHAR_MAX;}
	constexpr inline static unsigned char min() noexcept {return 0;}
	constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<signed char> {
	typedef signed char T ;
	constexpr inline static signed char max() noexcept {return SCHAR_MAX;}
	constexpr inline static signed char min() noexcept {return SCHAR_MIN;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<char> {
	typedef char T ;
	constexpr inline static char max() noexcept {return CHAR_MAX;}
	constexpr inline static char min() noexcept {return CHAR_MIN;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<unsigned short int> {
	typedef unsigned short int T ;
	constexpr inline static unsigned short int max() noexcept {return USHRT_MAX;}
	constexpr inline static unsigned short int min() noexcept {return 0;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<short int> {
	typedef short int T ;
	constexpr inline static short int max() noexcept {return SHRT_MAX;}
	constexpr inline static short int min() noexcept {return SHRT_MIN;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<unsigned int> {
	typedef unsigned int T ;
	constexpr inline static unsigned int max() noexcept {return UINT_MAX;}
	constexpr inline static unsigned int min() noexcept {return 0;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<int> {
	typedef int T ;
	constexpr inline static int max() noexcept {return INT_MAX;}
	constexpr inline static int min() noexcept {return INT_MIN;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<unsigned long> {
	typedef unsigned  long T ;
	constexpr inline static unsigned long max() noexcept {return ULONG_MAX;}
	constexpr inline static unsigned long min() noexcept {return 0;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<long> {
	typedef  long T ;
	constexpr inline static long max() noexcept {return LONG_MAX;}
	constexpr inline static long min() noexcept {return LONG_MIN;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<unsigned long long> {
	typedef unsigned long long T ;
	constexpr inline static unsigned long long max() noexcept {
		return ULLONG_MAX;
	}
	constexpr inline static unsigned long long min() noexcept {return 0;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<long long> {
	typedef long long T ;
	constexpr inline static long long max() noexcept {return LLONG_MAX;}
	constexpr inline static long long min() noexcept {return LLONG_MIN;}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<float> {
	typedef float T ;
	constexpr inline static int32_t max() noexcept {return (int32_t(1) << FLT_MANT_DIG) - 1;}
	constexpr inline static int32_t min() noexcept {return -((int32_t(1) << FLT_MANT_DIG) - 1);}
	constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<double> {
	typedef double T;
	constexpr inline static int64_t max() noexcept {return (int64_t(1) << DBL_MANT_DIG) - 1;}
	constexpr inline static int64_t min() noexcept {return -((int64_t(1) << DBL_MANT_DIG) - 1);}
    constexpr inline static int32_t digits() noexcept {return std:: numeric_limits<T>::digits ;}
};

template <> struct limits<Givaro::Integer> {
	typedef Givaro::Integer T;
	constexpr inline static int max() noexcept {return -1;}
	constexpr inline static int min() noexcept {return 0;}
};

template <size_t K> struct limits<RecInt::ruint<K> > {
	typedef RecInt::ruint<K> T;
	constexpr inline static RecInt::ruint<K> max() noexcept {return RecInt::ruint<K>(-1);}
	constexpr inline static RecInt::ruint<K> min() noexcept {return 0;}
};

template <size_t K> struct limits<RecInt::rint<K> > {
	typedef RecInt::ruint<K> T;
	constexpr inline static RecInt::rint<K> max() noexcept {return RecInt::rint<K>(RecInt::ruint<K>(-1) >> 1u);}
	constexpr inline static RecInt::rint<K> min() noexcept {return max() + 1;}
};
// template <size_t K> struct limits<RecInt::rint<K> > {
// 	constexpr inline static RecInt::rint<K> max() noexcept {return RecInt::rint<K>(RecInt::ruint<K>(-1))/2;}
	
// 	constexpr inline static RecInt::rint<K> min() noexcept {return -RecInt::rint<K>(RecInt::ruint<K>(-1))/2;}
// };
// template <size_t K,size_t MG> struct limits<RecInt::rmint<K,MG> > {
// 	constexpr inline static RecInt::ruint<K> max() noexcept {return RecInt::rmint<K,MG>(-1);}
	
// 	constexpr inline static RecInt::ruint<K> min() noexcept {return 0;}
// };

/*
 * in_range, determine if an element e of type E fit in a type T
 */

template<class T, class E>
typename std::enable_if<std::is_signed<T>::value == std::is_signed<E>::value, bool>::type
in_range(E e)
{
    return (e >= limits<T>::min() && e <= limits<T>::max());
}

template<class T, class E>
typename std::enable_if<(std::is_signed<T>::value) && !(std::is_signed<E>::value), bool>::type
	in_range(E e)
{
    return (e <= static_cast<E>(limits<T>::max()));
}

template<class T, class E>
typename std::enable_if<!(std::is_signed<T>::value) && (std::is_signed<E>::value), bool>::type
	in_range(E e)
{
    return ((e >= 0) && (static_cast<T>(e) <= limits<T>::max()));
}



#endif /* _FFLASFFPACK_limits_H */