Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
endian.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 Roc Streaming authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_core/endian.h
10//! @brief Endian conversion functions.
11
12#ifndef ROC_CORE_ENDIAN_H_
13#define ROC_CORE_ENDIAN_H_
14
15// This file provides explicitly-sized conveniently named short-hands
16// for endian conversion functions.
17
18#include "roc_core/endian_ops.h"
19
20namespace roc {
21namespace core {
22
23//! Network to host byte order (unsigned 16-bit).
24inline uint16_t ntoh16u(uint16_t v) {
26}
27
28//! Network to host byte order (signed 16-bit).
32
33//! Network to host byte order (unsigned 32-bit).
34inline uint32_t ntoh32u(uint32_t v) {
36}
37
38//! Network to host byte order (signed 32-bit).
39inline int32_t ntoh32s(int32_t v) {
41}
42
43//! Network to host byte order (unsigned 64-bit).
44inline uint64_t ntoh64u(uint64_t v) {
46}
47
48//! Network to host byte order (signed 64-bit).
49inline int64_t ntoh64s(int64_t v) {
51}
52
53//! Host to network byte order (unsigned 16-bit).
54inline uint16_t hton16u(uint16_t v) {
56}
57
58//! Host to network byte order (signed 16-bit).
62
63//! Host to network byte order (unsigned 32-bit).
64inline uint32_t hton32u(uint32_t v) {
66}
67
68//! Host to network byte order (signed 32-bit).
69inline int32_t hton32s(int32_t v) {
71}
72
73//! Host to network byte order (unsigned 64-bit).
74inline uint64_t hton64u(uint64_t v) {
76}
77
78//! Host to network byte order (signed 64-bit).
79inline int64_t hton64s(int64_t v) {
81}
82
83} // namespace core
84} // namespace roc
85
86#endif // ROC_CORE_ENDIAN_H_
static T swap_native_be(T v)
Swap between native endian and big endian.
Definition endian_ops.h:31
Shared ownership intrusive pointer.
Definition shared_ptr.h:32
Endian operations.
int32_t hton32s(int32_t v)
Host to network byte order (signed 32-bit).
Definition endian.h:69
uint16_t hton16u(uint16_t v)
Host to network byte order (unsigned 16-bit).
Definition endian.h:54
int32_t ntoh32s(int32_t v)
Network to host byte order (signed 32-bit).
Definition endian.h:39
int16_t hton16s(int16_t v)
Host to network byte order (signed 16-bit).
Definition endian.h:59
uint64_t hton64u(uint64_t v)
Host to network byte order (unsigned 64-bit).
Definition endian.h:74
uint16_t ntoh16u(uint16_t v)
Network to host byte order (unsigned 16-bit).
Definition endian.h:24
int64_t ntoh64s(int64_t v)
Network to host byte order (signed 64-bit).
Definition endian.h:49
uint64_t ntoh64u(uint64_t v)
Network to host byte order (unsigned 64-bit).
Definition endian.h:44
uint32_t hton32u(uint32_t v)
Host to network byte order (unsigned 32-bit).
Definition endian.h:64
int64_t hton64s(int64_t v)
Host to network byte order (signed 64-bit).
Definition endian.h:79
int16_t ntoh16s(int16_t v)
Network to host byte order (signed 16-bit).
Definition endian.h:29
uint32_t ntoh32u(uint32_t v)
Network to host byte order (unsigned 32-bit).
Definition endian.h:34
Root namespace.