Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BASE_FORMAT_MACROS_H_ | |
| 6 #define BASE_FORMAT_MACROS_H_ | |
| 7 | |
| 8 // This file defines the C99 format macros for 64-bit values. If you wish to | |
| 9 // print a 64-bit value in a portable way do: | |
| 10 // int64_t value; | |
| 11 // printf("xyz:%" PRId64, value); | |
| 12 // | |
| 13 // For wide strings, prepend "Wide" to the macro: | |
| 14 // int64_t value; | |
| 15 // StringPrintf(L"xyz: %" WidePRId64, value); | |
| 16 | |
| 17 #include "build/build_config.h" | |
| 18 | |
| 19 #if defined(OS_POSIX) | |
| 20 | |
| 21 #if defined(_INTTYPES_H) && !defined(PRId64) | |
|
Mark Mentovai
2009/06/25 18:02:18
There's no standard for system header guards - thi
| |
| 22 #error "inttypes.h has already been included before this header file, but " | |
| 23 #error "without __STDC_FORMAT_MACROS defined." | |
| 24 #endif | |
| 25 | |
| 26 #if !defined(__STDC_FORMAT_MACROS) | |
| 27 #define __STDC_FORMAT_MACROS | |
| 28 #endif | |
| 29 | |
| 30 #include <inttypes.h> | |
| 31 | |
| 32 // GCC will concatenate wide and narrow strings correctly, so nothing needs to | |
| 33 // be done here. | |
| 34 #define WidePRId64 PRId64 | |
| 35 #define WidePRIu64 PRIu64 | |
| 36 #define WidePRIx64 PRIx64 | |
| 37 | |
| 38 #else // OS_WIN | |
| 39 | |
| 40 #define PRId64 "I64d" | |
| 41 #define PRIu64 "I64u" | |
| 42 #define PRIx64 "I64x" | |
| 43 | |
| 44 #define WidePRId64 L"I64d" | |
| 45 #define WidePRIu64 L"I64u" | |
| 46 #define WidePRIx64 L"I64x" | |
| 47 | |
| 48 #endif | |
| 49 | |
| 50 #endif // !BASE_FORMAT_MACROS_H_ | |
| OLD | NEW |