nec2++ 2.1.1
typesafe_stdint.h
1/***************************************************************************
2 * Copyright (C) 2015 by Tim Molteno *
3 * tim@molteno.net *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
33#if TYPESAFE_PEDANTIC
34
35template<typename T>
36class typesafe_int {
37public:
38 typesafe_int(int x);
39
40 bool operator==(const typesafe_int<T>);
41 bool operator>=(const typesafe_int<T>);
42 bool operator<(const typesafe_int<T>);
43 bool operator>(const typesafe_int<T>);
44 typesafe_int<T>& operator*(const typesafe_int<T>);
45 typesafe_int<T>& operator/(const typesafe_int<T>);
46 typesafe_int<T>& operator+(const typesafe_int<T>);
47 typesafe_int<T>& operator-(const typesafe_int<T>);
48 typesafe_int<T>& operator++(int);
49};
50
51typedef typesafe_int<long long> int64_t;
52typedef typesafe_int<unsigned long long> uint64_t;
53
54typedef typesafe_int<long> int32_t;
55typedef typesafe_int<unsigned long> uint32_t;
56
57#else
58 #include <stdint.h>
59#endif
60