stdint.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Replacement stdint.h file for building GNU Emacs on Windows.
  2. Copyright (C) 2011-2016 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 (at
  7. 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 INTPTR_MIN INT64_MIN
  32. #define UINTPTR_MAX UINT64_MAX
  33. #define UINTMAX_MAX UINT64_MAX
  34. #define UINTMAX_MIN UINT64_MIN
  35. #define INTMAX_MAX INT64_MAX
  36. #define INTMAX_MIN INT64_MIN
  37. #define uintmax_t unsigned __int64
  38. #define intmax_t __int64
  39. #else
  40. typedef int intptr_t;
  41. typedef unsigned int uint32_t;
  42. #define UINT32_MAX 4294967295
  43. #define UINT32_MIN 0
  44. #define INT32_MAX 2147483647
  45. #define INT32_MIN (~INT32_MAX)
  46. #define INTPTR_MAX INT32_MAX
  47. #define INTPTR_MIN INT32_MIN
  48. #define UINTPTR_MAX UINT32_MAX
  49. #define UINTMAX_MAX UINT32_MAX
  50. #define UINTMAX_MIN UINT32_MIN
  51. #define INTMAX_MAX INT32_MAX
  52. #define INTMAX_MIN INT32_MIN
  53. #define uintmax_t unsigned long
  54. #define intmax_t long
  55. #endif
  56. #define PTRDIFF_MAX INTPTR_MAX
  57. #define PTRDIFF_MIN INTPTR_MIN
  58. #define SIZE_MAX UINTPTR_MAX
  59. #endif /* !__GNUC__ */
  60. #endif /* _NT_STDINT_H_ */