[3745] | 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 |
|
---|
[23508] | 25 | #include "mglong.h"
|
---|
| 26 |
|
---|
[3745] | 27 | #ifndef __WIN32__
|
---|
| 28 | #include "config.h"
|
---|
| 29 | #endif
|
---|
| 30 |
|
---|
| 31 | /*
|
---|
| 32 | Use GCC's "long long" integer types for certain variables, to avoid
|
---|
| 33 | overflowing 32 bit integers.
|
---|
| 34 |
|
---|
| 35 | Other files affected:
|
---|
| 36 |
|
---|
| 37 | lib:
|
---|
| 38 | bitio_random.c
|
---|
| 39 | bitio_random.h
|
---|
| 40 |
|
---|
| 41 | src/text:
|
---|
| 42 | ivf.pass1.c
|
---|
| 43 | ivf.pass2.c
|
---|
| 44 | build.h
|
---|
| 45 | mg_passes.c
|
---|
| 46 | text.h
|
---|
| 47 | mgstat.c
|
---|
| 48 | */
|
---|
| 49 |
|
---|
| 50 | /*#define TESTING_OVERFLOW*/
|
---|
| 51 |
|
---|
| 52 | #ifdef TESTING_OVERFLOW
|
---|
| 53 |
|
---|
| 54 | /* Test the overflow detection by using tiny (16-bit) types */
|
---|
| 55 | typedef unsigned short int mg_ullong;
|
---|
| 56 | typedef short int mg_llong;
|
---|
| 57 |
|
---|
| 58 | #define ULL_FS "u"
|
---|
| 59 | #define LL_FS "d"
|
---|
| 60 |
|
---|
| 61 | #elif defined __GNUC__ && ! defined DISABLE_LONG_LONG
|
---|
| 62 |
|
---|
| 63 | /* We're using GCC, so it's okay to use "long long" (64-bit) types */
|
---|
| 64 | #define USE_LONG_LONG
|
---|
| 65 |
|
---|
| 66 | typedef unsigned long long int mg_ullong;
|
---|
| 67 | typedef long long int mg_llong;
|
---|
| 68 |
|
---|
| 69 | #define ULL_FS "llu"
|
---|
| 70 | #define LL_FS "lld"
|
---|
| 71 |
|
---|
| 72 | #else
|
---|
| 73 |
|
---|
| 74 | /* Not using GCC, so fall back on plain "long" (32-bit) types */
|
---|
[23508] | 75 | typedef uint32_t mg_ullong;
|
---|
| 76 | typedef int32_t mg_llong;
|
---|
[3745] | 77 |
|
---|
[23508] | 78 | #define ULL_FS "u"
|
---|
| 79 | #define LL_FS "d"
|
---|
[3745] | 80 |
|
---|
| 81 | #endif /* __GNUC__ */
|
---|
| 82 |
|
---|
| 83 | #endif
|
---|