Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinilm
Commits
afab9951
Commit
afab9951
authored
Jun 26, 2025
by
wooway777
Browse files
Adjusted address arithmetic types
parent
ae847081
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/allocator/memory_allocator.cpp
src/allocator/memory_allocator.cpp
+2
-2
No files found.
src/allocator/memory_allocator.cpp
View file @
afab9951
...
...
@@ -49,7 +49,7 @@ void *MemoryPool::alloc(size_t size) {
// Align the pointer within the block
void
*
aligned_ptr
=
alignPointer
(
block
.
ptr
);
size_t
alignment_padding
=
reinterpret_cast
<
uintptr_t
>
(
aligned_ptr
)
-
reinterpret_cast
<
uintptr_t
>
(
block
.
ptr
);
size_t
alignment_padding
=
reinterpret_cast
<
char
*
>
(
aligned_ptr
)
-
reinterpret_cast
<
char
*
>
(
block
.
ptr
);
// Calculate remaining space after allocation
const
size_t
remaining
=
block
.
size
-
aligned_size
-
alignment_padding
;
...
...
@@ -100,7 +100,7 @@ void *MemoryPool::allocateNewRegion(size_t size) {
// Align the pointer within the allocated region
void
*
aligned_ptr
=
alignPointer
(
ptr
);
size_t
alignment_padding
=
reinterpret_cast
<
uintptr_t
>
(
aligned_ptr
)
-
reinterpret_cast
<
uintptr_t
>
(
ptr
);
size_t
alignment_padding
=
reinterpret_cast
<
char
*
>
(
aligned_ptr
)
-
reinterpret_cast
<
char
*
>
(
ptr
);
size_t
usable_size
=
size
-
alignment_padding
;
Block
new_block
(
ptr
,
aligned_ptr
,
usable_size
,
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment