IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
memsys
public
ice
mem_utils.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/mem_info.hxx
>
6
#include <
ice/mem_arithmetic.hxx
>
7
#include <type_traits>
8
9
namespace
ice
10
{
11
12
constexpr
auto
mem_max_capacity
(ice::usize element_size, ice::usize memory_space)
noexcept
->
ice::u64
;
13
14
template
<
typename
T>
15
constexpr
auto
mem_max_capacity
(ice::usize memory_space)
noexcept
->
ice::u64
;
16
17
constexpr
auto
mem_max_capacity
(
ice::usize
element_size,
ice::usize
memory_space)
noexcept
->
ice::u64
18
{
19
return
ice::u64
{ memory_space.value / element_size.value };
20
}
21
22
template
<
typename
T>
23
constexpr
auto
mem_max_capacity
(
ice::usize
memory_space)
noexcept
->
ice::u64
24
{
25
return
ice::mem_max_capacity
(
ice::size_of<T>
, memory_space);
26
}
27
28
}
// namespace ice
mem_arithmetic.hxx
mem_info.hxx
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::size_of
constexpr ice::usize size_of
Definition
mem_info.hxx:12
ice::u64
std::uint64_t u64
Definition
types.hxx:27
ice::mem_max_capacity
constexpr auto mem_max_capacity(ice::usize element_size, ice::usize memory_space) noexcept -> ice::u64
Definition
mem_utils.hxx:17
ice::usize
Represents a unsigned size value on the given platform.
Definition
mem_size_types.hxx:26
Generated by
1.18.0