stdint.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Replacement stdint.h file for building GNU Emacs on Windows.
  2. Copyright (C) 2011-2012 Free Software Foundation, Inc.
  3. This file is part of GNU Emacs.
  4. GNU Emacs is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. GNU Emacs is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef _NT_STDINT_H_
  15. #define _NT_STDINT_H_
  16. #ifdef __GNUC__
  17. # include_next <stdint.h> /* use stdint.h if available */
  18. #else /* !__GNUC__ */
  19. /* Minimum definitions to allow compilation with tool chains where
  20. stdint.h is not available, e.g. Microsoft Visual Studio. */
  21. #ifdef _WIN64
  22. typedef __int64 intptr_t;
  23. typedef unsigned int uint32_t;
  24. typedef unsigned __int64 uint64_t;
  25. #define UINT64_MAX (18446744073709551615i64)
  26. #define UINT64_MIN 0
  27. /* "i64" is the non-standard suffix used by MSVC for 64-bit constants. */
  28. #define INT64_MAX 9223372036854775807i64
  29. #define INT64_MIN (~INT64_MAX)
  30. #define INTPTR_MAX INT64_MAX
  31. #define UINTMAX_MAX UINT64_MAX
  32. #define UINTMAX_MIN UINT64_MIN
  33. #define INTMAX_MAX INT64_MAX
  34. #define INTMAX_MIN INT64_MIN
  35. #define uintmax_t unsigned __int64
  36. #define intmax_t __int64
  37. #else
  38. typedef int intptr_t;
  39. typedef unsigned int uint32_t;
  40. #define UINT32_MAX 4294967295
  41. #define UINT32_MIN 0
  42. #define INT32_MAX 2147483647
  43. #define INT32_MIN (~INT32_MAX)
  44. #define INTPTR_MAX INT32_MAX
  45. #define UINTMAX_MAX UINT32_MAX
  46. #define UINTMAX_MIN UINT32_MIN
  47. #define INTMAX_MAX INT32_MAX
  48. #define INTMAX_MIN INT32_MIN
  49. #define uintmax_t unsigned long
  50. #define intmax_t long
  51. #endif
  52. #define PTRDIFF_MAX INTPTR_MAX
  53. #endif /* !__GNUC__ */
  54. #endif /* _NT_STDINT_H_ */