stddef.h 579 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) mlibc & plct lab
  3. *
  4. * SPDX-License-Identifier: MIT
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021/02/17 Bernard first version
  9. */
  10. #ifndef MLIBC_STDDEF_H__
  11. #define MLIBC_STDDEF_H__
  12. #ifdef __cplusplus
  13. #define NULL (0)
  14. #else
  15. #define NULL ((void*)0)
  16. #endif /*__cplusplus*/
  17. #define offsetof(type, member) ((size_t) &((type *)0)->member)
  18. #if (defined(__GNUC__) && (__SIZEOF_POINTER__ == 8))
  19. typedef signed long long ptrdiff_t;
  20. #else
  21. typedef signed int ptrdiff_t;
  22. #endif /* __GNUC__ */
  23. #endif /*MLIBC_STDDEF_H__*/