Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / utility / safe_browsing / mac / convert_big_endian.h
blob00a648e4431c468d40865416346de9af9fe0fbd8
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
3 // found in the LICENSE file.
5 #ifndef CHROME_UTILITY_SAFE_BROWSING_MAC_CONVERT_BIG_ENDIAN_H_
6 #define CHROME_UTILITY_SAFE_BROWSING_MAC_CONVERT_BIG_ENDIAN_H_
8 #include <libkern/OSByteOrder.h>
9 #include <sys/types.h>
11 // 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 // 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 // themselves are macros that call compiler intrinsics.
17 namespace safe_browsing {
18 namespace dmg {
20 inline void ConvertBigEndian(uint16_t* x) {
21 *x = OSSwapBigToHostInt16(*x);
24 inline void ConvertBigEndian(int16_t* x) {
25 *x = OSSwapBigToHostInt16(*x);
28 inline void ConvertBigEndian(uint32_t* x) {
29 *x = OSSwapBigToHostInt32(*x);
32 inline void ConvertBigEndian(uint64_t* x) {
33 *x = OSSwapBigToHostInt64(*x);
36 } // namespace dmg
37 } // namespace safe_browsing
39 #endif // CHROME_UTILITY_SAFE_BROWSING_MAC_CONVERT_BIG_ENDIAN_H_