stdint.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) mlibc & plct lab
  3. *
  4. * SPDX-License-Identifier: MIT
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023/06/16 bernard the first verison
  9. */
  10. #ifndef MLIBC_STDINT_H__
  11. #define MLIBC_STDINT_H__
  12. #ifdef __cplusplus
  13. #define NULL (0)
  14. #else
  15. #define NULL ((void*)0)
  16. #endif /*__cplusplus*/
  17. typedef signed char int8_t;
  18. typedef signed short int16_t;
  19. typedef signed int int32_t;
  20. typedef signed long long int64_t;
  21. typedef unsigned char uint8_t;
  22. typedef unsigned short uint16_t;
  23. typedef unsigned int uint32_t;
  24. typedef unsigned long long uint64_t;
  25. typedef unsigned long uintptr_t;
  26. #define INT8_MIN (-1-0x7f)
  27. #define INT16_MIN (-1-0x7fff)
  28. #define INT32_MIN (-1-0x7fffffff)
  29. #define INT64_MIN (-1-0x7fffffffffffffff)
  30. #define INT8_MAX (0x7f)
  31. #define INT16_MAX (0x7fff)
  32. #define INT32_MAX (0x7fffffff)
  33. #define INT64_MAX (0x7fffffffffffffff)
  34. #define UINT8_MAX (0xff)
  35. #define UINT16_MAX (0xffff)
  36. #define UINT32_MAX (0xffffffffu)
  37. #define UINT64_MAX (0xffffffffffffffffu)
  38. /* for 32bit */
  39. #define INTPTR_MIN INT32_MIN
  40. #define INTPTR_MAX INT32_MAX
  41. #define UINTPTR_MAX UINT32_MAX
  42. #define PTRDIFF_MIN INT32_MIN
  43. #define PTRDIFF_MAX INT32_MAX
  44. #define SIZE_MAX UINT32_MAX
  45. #endif /*MLIBC_STDINT_H__*/