summaryrefslogtreecommitdiff
path: root/include/compression/my64bit.h
blob: fb2d5d037b55688708ad5628c2e5f2171ab10561 (plain)
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
/* This code is part of the tng compression routines.
 *
 * Written by Daniel Spangberg
 * Copyright (c) 2010, 2013, The GROMACS development team.
 *
 *
 * This program 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.
 */


/* Here presence of 64 bit integers are checked for. If on windows
   define USE_WINDOWS if it does not get defined automatically. 
   If on UNIX, define the sizes of SIZEOF_INT, SIZEOF_LONG, SIZEOF_LONG_LONG
   If none of these symbols are defined, stdint.h is included (if on C99
   or USE_STDINT is defined) and 64 bit integers are assumed to be
   present. If none of this is fulfilled, 64 bit integers are not
   available. */

#ifndef MY64BIT_H
#define MY64BIT_H

#if HAVE_CONFIG_H
#include <config.h>
#endif

#if HAVE_STDINT_H
#include <stdint.h>
#endif

/* The USE_WINDOWS symbol should be automatically defined in tng_compress.h */
#include "tng_compress.h"

#ifdef USE_WINDOWS
typedef __int64 my_int64_t;
typedef unsigned __int64 my_uint64_t;
#define HAVE64BIT
#else  /* USE_WINDOWS */
/* UNIX. Use config.h */
#if SIZEOF_INT >= 8 
typedef int my_int64_t;
typedef unsigned int my_uint64_t;
#define HAVE64BIT
#else /* SIZEOF_INT */
#if SIZEOF_LONG >= 8 
typedef long my_int64_t;
typedef unsigned long my_uint64_t;
#define HAVE64BIT
#else /* SIZEOF_LONG */
#if SIZEOF_LONG_LONG >= 8 
typedef long long my_int64_t;
typedef unsigned long long my_uint64_t;
#define HAVE64BIT
#else /* SIZEOF_LONG_LONG */
#if HAVE_STDINT_H
typedef int64_t my_int64_t;
typedef uint64_t my_uint64_t;
#define HAVE64BIT
#endif /* STDINT_H */
#endif /* SIZEOF_LONG_LONG */
#endif /* SIZEOF_LONG */
#endif /* SIZEOF_INT */
#endif  /* USE_WINDOWS */

#endif
contact: Jan Huwald // Impressum