IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
mem_utils.hxx
Go to the documentation of this file.
1
3
4#pragma once
5#include <ice/mem_info.hxx>
7#include <type_traits>
8
9namespace 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
SPDX-License-Identifier: MIT.
Definition array.hxx:12
constexpr ice::usize size_of
Definition mem_info.hxx:12
std::uint64_t u64
Definition types.hxx:27
constexpr auto mem_max_capacity(ice::usize element_size, ice::usize memory_space) noexcept -> ice::u64
Definition mem_utils.hxx:17
Represents a unsigned size value on the given platform.
Definition mem_size_types.hxx:26