OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_UTILITY_SAFE_BROWSING_MAC_CONVERT_BIG_ENDIAN_H_ | 5 #ifndef CHROME_UTILITY_SAFE_BROWSING_MAC_CONVERT_BIG_ENDIAN_H_ |
6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_CONVERT_BIG_ENDIAN_H_ | 6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_CONVERT_BIG_ENDIAN_H_ |
7 | 7 |
8 #include <libkern/OSByteOrder.h> | 8 #include <libkern/OSByteOrder.h> |
| 9 #include <stdint.h> |
9 #include <sys/types.h> | 10 #include <sys/types.h> |
10 | 11 |
11 // This file contains byte swapping routines for use in safe_browsing::dmg. The | 12 // This file contains byte swapping routines for use in safe_browsing::dmg. The |
12 // pattern is to use type-based overloading of the form ConvertBigEndian(T*) to | 13 // pattern is to use type-based overloading of the form ConvertBigEndian(T*) to |
13 // swap all structures from big-endian to host-endian. This file provides the | 14 // swap all structures from big-endian to host-endian. This file provides the |
14 // implementations for scalars, which are inlined since the OSSwap functions | 15 // implementations for scalars, which are inlined since the OSSwap functions |
15 // themselves are macros that call compiler intrinsics. | 16 // themselves are macros that call compiler intrinsics. |
16 | 17 |
17 namespace safe_browsing { | 18 namespace safe_browsing { |
18 namespace dmg { | 19 namespace dmg { |
(...skipping 11 matching lines...) Expand all Loading... |
30 } | 31 } |
31 | 32 |
32 inline void ConvertBigEndian(uint64_t* x) { | 33 inline void ConvertBigEndian(uint64_t* x) { |
33 *x = OSSwapBigToHostInt64(*x); | 34 *x = OSSwapBigToHostInt64(*x); |
34 } | 35 } |
35 | 36 |
36 } // namespace dmg | 37 } // namespace dmg |
37 } // namespace safe_browsing | 38 } // namespace safe_browsing |
38 | 39 |
39 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_CONVERT_BIG_ENDIAN_H_ | 40 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_CONVERT_BIG_ENDIAN_H_ |
OLD | NEW |