1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// libwebp v1.6.0, src/utils/endian_inl_utils.h:
//
// Copyright 2014 Google Inc. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the COPYING file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS. All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
// -----------------------------------------------------------------------------
//
// Endian related functions.
//! Translation of `src/utils/endian_inl_utils.h` from libwebp v1.6.0.
//!
//! Work package: WP1 (types, memory, workers).
//!
//! The `HAVE_BUILTIN_*` detection and the MIPS and x86 assembly alternatives of
//! the byte swaps are preprocessor choices of one implementation; each Rust
//! function below is the portable operation that every C variant computes.
// upstream: src/utils/endian_inl_utils.h HToLE32
/// Converts a host `u32` to little-endian order; the identity on little-endian hosts.
// upstream: src/utils/endian_inl_utils.h HToLE16
/// Converts a host `u16` to little-endian order; the identity on little-endian hosts.
// upstream: src/utils/endian_inl_utils.h BSwap16
/// Reverses the bytes of a `u16`.
// upstream: src/utils/endian_inl_utils.h BSwap32
/// Reverses the bytes of a `u32`.
// upstream: src/utils/endian_inl_utils.h BSwap64
/// Reverses the bytes of a `u64`.