IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
mem_allocator_utils.hxx
Go to the documentation of this file.
1
3
4#pragma once
6
7namespace ice
8{
9
11 {
12 if (data.size == 0_B)
13 {
14 return {};
15 }
16
17 ice::Memory const result = alloc.allocate({ data.size, data.alignment });
18 if (result.location != nullptr)
19 {
20 ice::memcpy(result, data);
21 }
22 return result;
23 }
24
25} // namespace ice
Definition span.hxx:129
SPDX-License-Identifier: MIT.
Definition array.hxx:12
auto data_copy(ice::Allocator &alloc, ice::Data data) noexcept -> ice::Memory
Definition mem_allocator_utils.hxx:10
auto alloc(ice::usize size) noexcept -> ice::AllocResult
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition mem_types.hxx:25
auto memcpy(void *dest, void const *source, ice::usize size) noexcept -> void *
Definition mem_data.hxx:17
Definition mem_memory.hxx:13
void * location
Definition mem_memory.hxx:14