| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_FORMAT_MACROS_H_ | 5 #ifndef BASE_FORMAT_MACROS_H_ |
| 6 #define BASE_FORMAT_MACROS_H_ | 6 #define BASE_FORMAT_MACROS_H_ |
| 7 | 7 |
| 8 // This file defines the format macros for some integer types. | 8 // This file defines the format macros for some integer types. |
| 9 | 9 |
| 10 // To print a 64-bit value in a portable way: | 10 // To print a 64-bit value in a portable way: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // GCC will concatenate wide and narrow strings correctly, so nothing needs to | 39 // GCC will concatenate wide and narrow strings correctly, so nothing needs to |
| 40 // be done here. | 40 // be done here. |
| 41 #define WidePRId64 PRId64 | 41 #define WidePRId64 PRId64 |
| 42 #define WidePRIu64 PRIu64 | 42 #define WidePRIu64 PRIu64 |
| 43 #define WidePRIx64 PRIx64 | 43 #define WidePRIx64 PRIx64 |
| 44 | 44 |
| 45 #if !defined(PRIuS) | 45 #if !defined(PRIuS) |
| 46 #define PRIuS "zu" | 46 #define PRIuS "zu" |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 // The size of NSInteger and NSUInteger varies between 32-bit and 64-bit |
| 50 // architectures and Apple does not provides standard format macros and |
| 51 // recommends casting. This has many drawbacks, so instead define macros |
| 52 // for formatting those types. |
| 53 #if defined(OS_MACOSX) |
| 54 #if defined(ARCH_CPU_64_BITS) |
| 55 #if !defined(PRIdNS) |
| 56 #define PRIdNS "ld" |
| 57 #endif |
| 58 #if !defined(PRIuNS) |
| 59 #define PRIuNS "lu" |
| 60 #endif |
| 61 #if !defined(PRIxNS) |
| 62 #define PRIxNS "lx" |
| 63 #endif |
| 64 #else // defined(ARCH_CPU_64_BITS) |
| 65 #if !defined(PRIdNS) |
| 66 #define PRIdNS "d" |
| 67 #endif |
| 68 #if !defined(PRIuNS) |
| 69 #define PRIuNS "u" |
| 70 #endif |
| 71 #if !defined(PRIxNS) |
| 72 #define PRIxNS "x" |
| 73 #endif |
| 74 #endif |
| 75 #endif // defined(OS_MACOSX) |
| 76 |
| 49 #else // OS_WIN | 77 #else // OS_WIN |
| 50 | 78 |
| 51 #if !defined(PRId64) | 79 #if !defined(PRId64) |
| 52 #define PRId64 "I64d" | 80 #define PRId64 "I64d" |
| 53 #endif | 81 #endif |
| 54 | 82 |
| 55 #if !defined(PRIu64) | 83 #if !defined(PRIu64) |
| 56 #define PRIu64 "I64u" | 84 #define PRIu64 "I64u" |
| 57 #endif | 85 #endif |
| 58 | 86 |
| 59 #if !defined(PRIx64) | 87 #if !defined(PRIx64) |
| 60 #define PRIx64 "I64x" | 88 #define PRIx64 "I64x" |
| 61 #endif | 89 #endif |
| 62 | 90 |
| 63 #define WidePRId64 L"I64d" | 91 #define WidePRId64 L"I64d" |
| 64 #define WidePRIu64 L"I64u" | 92 #define WidePRIu64 L"I64u" |
| 65 #define WidePRIx64 L"I64x" | 93 #define WidePRIx64 L"I64x" |
| 66 | 94 |
| 67 #if !defined(PRIuS) | 95 #if !defined(PRIuS) |
| 68 #define PRIuS "Iu" | 96 #define PRIuS "Iu" |
| 69 #endif | 97 #endif |
| 70 | 98 |
| 71 #endif | 99 #endif |
| 72 | 100 |
| 73 #endif // BASE_FORMAT_MACROS_H_ | 101 #endif // BASE_FORMAT_MACROS_H_ |
| OLD | NEW |