source: trunk/gsdl/src/mgpp/lib/longlong.h@ 855

Last change on this file since 855 was 855, checked in by sjboddie, 24 years ago

Rodgers new C++ mg

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1/**************************************************************************
2 *
3 * longlong.h -- Use of GCC's long long integer types
4 * Copyright (C) 1999 Tim A.H. Bell
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 **************************************************************************/
21
22#ifndef H_LONGLONG
23#define H_LONGLONG
24
25#include "config.h"
26
27/*
28 Use GCC's "long long" integer types for certain variables, to avoid
29 overflowing 32 bit integers.
30
31 Other files affected:
32
33 lib:
34 bitio_random.c
35 bitio_random.h
36
37 src/text:
38 ivf.pass1.c
39 ivf.pass2.c
40 build.h
41 mg_passes.c
42 text.h
43
44*/
45
46/*#define TESTING_OVERFLOW*/
47
48#ifdef TESTING_OVERFLOW
49
50/* Test the overflow detection by using tiny (16-bit) types */
51typedef unsigned short int mg_ullong;
52typedef short int mg_llong;
53
54#define ULL_FS "u"
55#define LL_FS "d"
56
57#elif defined __GNUC__ && ! defined DISABLE_LONG_LONG
58
59/* We're using GCC, so it's okay to use "long long" (64-bit) types */
60#define USE_LONG_LONG
61
62typedef unsigned long long int mg_ullong;
63typedef long long int mg_llong;
64
65#define ULL_FS "llu"
66#define LL_FS "lld"
67
68#else
69
70/* Not using GCC, so fall back on plain "long" (32-bit) types */
71typedef unsigned long int mg_ullong;
72typedef long int mg_llong;
73
74#define ULL_FS "lu"
75#define LL_FS "ld"
76
77#endif /* __GNUC__ */
78
79#endif
Note: See TracBrowser for help on using the repository browser.