SizePrintfMacros.h 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /* Implements (nonstandard) PRI{ouxX}SIZE format macros for size_t types. */
  6. #ifndef mozilla_SizePrintfMacros_h_
  7. #define mozilla_SizePrintfMacros_h_
  8. /*
  9. * MSVC's libc does not support C99's %z format length modifier for size_t
  10. * types. Instead, we use Microsoft's nonstandard %I modifier for size_t, which
  11. * is unsigned __int32 on 32-bit platforms and unsigned __int64 on 64-bit
  12. * platforms:
  13. *
  14. * http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx
  15. */
  16. #if defined(XP_WIN)
  17. # define PRIoSIZE "Io"
  18. # define PRIuSIZE "Iu"
  19. # define PRIxSIZE "Ix"
  20. # define PRIXSIZE "IX"
  21. #else
  22. # define PRIoSIZE "zo"
  23. # define PRIuSIZE "zu"
  24. # define PRIxSIZE "zx"
  25. # define PRIXSIZE "zX"
  26. #endif
  27. #endif /* mozilla_SizePrintfMacros_h_ */