smartmontools SVN Rev 3317
Utility to control and monitor storage systems with "S.M.A.R.T."
int64.h
Go to the documentation of this file.
00001 /*
00002  * int64.h
00003  *
00004  * Home page of code is: http://smartmontools.sourceforge.net
00005  *
00006  * Copyright (C) 2002-11 Bruce Allen <smartmontools-support@lists.sourceforge.net>
00007  * Copyright (C) 2004-11 Christian Franke
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2, or (at your option)
00012  * any later version.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * (for example COPYING); if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  *
00018  */
00019 
00020 #ifndef INT64_H_
00021 #define INT64_H_
00022 
00023 #define INT64_H_CVSID "$Id: int64.h 3727 2012-12-13 17:23:06Z samm2 $"
00024 
00025 // 64 bit integer typedefs and format strings
00026 
00027 #ifdef HAVE_INTTYPES_H
00028 // The ISO C99 standard specifies that in C++ implementations the PRI* macros
00029 // from <inttypes.h> should only be defined if explicitly requested
00030 #define __STDC_FORMAT_MACROS 1
00031 #include <inttypes.h> // PRId64, PRIu64, PRIx64 (also includes <stdint.h>)
00032 #else
00033 #ifdef HAVE_STDINT_H
00034 #include <stdint.h> // int64_t, uint64_t (usually included above)
00035 #else
00036 #ifdef HAVE_SYS_INTTYPES_H
00037 #include <sys/inttypes.h>
00038 #else
00039 #ifdef HAVE_SYS_INT_TYPES_H
00040 #include <sys/int_types.h>
00041 #else
00042 #if defined(_WIN32) && defined(_MSC_VER)
00043 // for MSVC <= 9 (MSVC10 and MinGW provide <stdint.h>)
00044 typedef          __int64    int64_t;
00045 typedef unsigned __int64   uint64_t;
00046 #else
00047 // for systems with above includes missing (like ix86-pc-linux-gnulibc1),
00048 // default to GCC if types are undefined in types.h
00049 #include <sys/types.h>
00050 #ifndef HAVE_INT64_T
00051 typedef          long long  int64_t;
00052 #endif
00053 #ifndef HAVE_UINT64_T
00054 typedef unsigned long long uint64_t;
00055 #endif
00056 #endif // _WIN32 && _MSC_VER
00057 #endif // HAVE_SYS_INT_TYPES_H
00058 #endif // HAVE_SYS_INTTYPES_H
00059 #endif // HAVE_STDINT_H
00060 #endif // HAVE_INTTYPES_H
00061 
00062 #if defined(_WIN32) && !defined(PRId64)
00063 // for MSVC (MinGW provides <inttypes.h>)
00064 #define PRId64 "I64d"
00065 #define PRIu64 "I64u"
00066 #define PRIx64 "I64x"
00067 #endif // _WIN32 && !PRId64
00068 
00069 // If macros not defined in inttypes.h, fix here.  Default is GCC
00070 // style
00071 #ifndef PRId64
00072 #define PRId64 "lld"
00073 #endif // ndef PRId64
00074 
00075 #ifndef PRIu64
00076 #define PRIu64 "llu"
00077 #endif // ndef PRIu64
00078 
00079 #ifndef PRIx64
00080 #define PRIx64 "llx"
00081 #endif // ndef PRIx64
00082 
00083 #endif // INT64_H