• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 The WebM project authors. All Rights Reserved.
2 //
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source
5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS.  All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree.
8 
9 #ifndef LIBWEBM_COMMON_WEBM_ENDIAN_H_
10 #define LIBWEBM_COMMON_WEBM_ENDIAN_H_
11 
12 #include <stdint.h>
13 
14 namespace libwebm {
15 
16 // Swaps unsigned 32 bit values to big endian if needed. Returns |value| if
17 // architecture is big endian. Returns big endian value if architecture is
18 // little endian. Returns 0 otherwise.
19 uint32_t host_to_bigendian(uint32_t value);
20 
21 // Swaps unsigned 32 bit values to little endian if needed. Returns |value| if
22 // architecture is big endian. Returns little endian value if architecture is
23 // little endian. Returns 0 otherwise.
24 uint32_t bigendian_to_host(uint32_t value);
25 
26 // Swaps unsigned 64 bit values to big endian if needed. Returns |value| if
27 // architecture is big endian. Returns big endian value if architecture is
28 // little endian. Returns 0 otherwise.
29 uint64_t host_to_bigendian(uint64_t value);
30 
31 // Swaps unsigned 64 bit values to little endian if needed. Returns |value| if
32 // architecture is big endian. Returns little endian value if architecture is
33 // little endian. Returns 0 otherwise.
34 uint64_t bigendian_to_host(uint64_t value);
35 
36 }  // namespace libwebm
37 
38 #endif  // LIBWEBM_COMMON_WEBM_ENDIAN_H_
39