source: main/trunk/greenstone2/common-src/indexers/mgpp/lib/longlong.h@ 25492

Last change on this file since 25492 was 25492, checked in by ak19, 12 years ago

Joshua Scarsbrook found that compilation failed on Macs (he was compiling GS3, but the compilation failed in GS2 code) and that this had to do with unix not being defined on macs, so that the compiler went on to the Windows part of the hash-definition and then failed. Dr Bainbridge found there was an equivalent APPLE definition which would be true for all Mac operating systems (including iPhones).

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 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#ifdef HAVE_CONFIG_H
26# ifdef __WIN32__
27# include <win32cfg.h>
28# else
29# include <config.h>
30# endif
31#endif
32
33/*
34 Use GCC's "long long" integer types for certain variables, to avoid
35 overflowing 32 bit integers.
36
37 Other files affected:
38
39 lib:
40 bitio_random.c
41 bitio_random.h
42
43 src/text:
44 ivf.pass1.c
45 ivf.pass2.c
46 build.h
47 mg_passes.c
48 text.h
49
50*/
51
52/*#define TESTING_OVERFLOW*/
53
54#ifdef TESTING_OVERFLOW
55
56/* Test the overflow detection by using tiny (16-bit) types */
57typedef unsigned short int mg_ullong;
58typedef short int mg_llong;
59
60#define ULL_FS "u"
61#define LL_FS "d"
62
63#elif defined __GNUC__ && ! defined DISABLE_LONG_LONG
64
65/* We're using GCC, so it's okay to use "long long" (64-bit) types */
66#define USE_LONG_LONG
67
68typedef unsigned long long int mg_ullong;
69typedef long long int mg_llong;
70
71#define ULL_FS "llu"
72#define LL_FS "lld"
73
74#else
75
76#if defined __unix__ || defined __APPLE__
77#include <stdint.h>
78#else
79typedef __int8 int8_t;
80typedef __int16 int16_t;
81typedef __int32 int32_t;
82typedef __int64 int64_t;
83typedef unsigned __int8 uint8_t;
84typedef unsigned __int16 uint16_t;
85typedef unsigned __int32 uint32_t;
86typedef unsigned __int64 uint64_t;
87#endif
88/* Not using GCC, so fall back on plain "long" (32-bit) types */
89typedef uint32_t mg_ullong;
90typedef int32_t mg_llong;
91
92#define ULL_FS "lu"
93#define LL_FS "ld"
94
95#endif /* __GNUC__ */
96
97#endif
Note: See TracBrowser for help on using the repository browser.