Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
align_ops.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 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/align_ops.h
10
//! @brief Alignment operations.
11
12
#ifndef ROC_CORE_ALIGN_OPS_H_
13
#define ROC_CORE_ALIGN_OPS_H_
14
15
#include "
roc_core/stddefs.h
"
16
17
namespace
roc
{
18
namespace
core
{
19
20
//! Maximum aligned data unit.
21
union
AlignMax
{
22
uint64_t
u
;
//!< 8-byte integer.
23
double
d
;
//!< 8-byte floating point.
24
void (*
p
)();
//!< 4-, 8- or 16-byte function pointer.
25
};
26
27
//! Alignment operations.
28
class
AlignOps
{
29
public
:
30
//! Get maximum alignment for current platform.
31
static
size_t
max_alignment
();
32
33
//! Return size aligned to maximum alignment.
34
static
size_t
align_max
(
size_t
size);
35
36
//! Return size aligned to given alignment.
37
static
size_t
align_as
(
size_t
size,
size_t
alignment);
38
39
//! Return padding needed for maximum alignment.
40
static
size_t
pad_max
(
size_t
size);
41
42
//! Return padding needed for given alignment.
43
static
size_t
pad_as
(
size_t
size,
size_t
alignment);
44
};
45
46
}
// namespace core
47
}
// namespace roc
48
49
#endif
// ROC_CORE_ALIGN_OPS_H_
roc::core::AlignOps
Alignment operations.
Definition
align_ops.h:28
roc::core::AlignOps::pad_max
static size_t pad_max(size_t size)
Return padding needed for maximum alignment.
roc::core::AlignOps::align_as
static size_t align_as(size_t size, size_t alignment)
Return size aligned to given alignment.
roc::core::AlignOps::pad_as
static size_t pad_as(size_t size, size_t alignment)
Return padding needed for given alignment.
roc::core::AlignOps::align_max
static size_t align_max(size_t size)
Return size aligned to maximum alignment.
roc::core::AlignOps::max_alignment
static size_t max_alignment()
Get maximum alignment for current platform.
roc::core
General-purpose building blocks and platform abstraction layer.
roc
Root namespace.
stddefs.h
Commonly used types and functions.
roc::core::AlignMax
Maximum aligned data unit.
Definition
align_ops.h:21
roc::core::AlignMax::p
void(* p)()
4-, 8- or 16-byte function pointer.
Definition
align_ops.h:24
roc::core::AlignMax::d
double d
8-byte floating point.
Definition
align_ops.h:23
roc::core::AlignMax::u
uint64_t u
8-byte integer.
Definition
align_ops.h:22
roc_core
align_ops.h
Generated by
1.17.0