[Scummvm-git-logs] scummvm master -> df7c5b107665aeb1ce1ca7d00ac3f3fe515c03ab
dwatteau
noreply at scummvm.org
Thu Apr 17 10:52:51 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
df7c5b1076 AGOS: Don't use any unnecessary loop in alignTableMem()
Commit: df7c5b107665aeb1ce1ca7d00ac3f3fe515c03ab
https://github.com/scummvm/scummvm/commit/df7c5b107665aeb1ce1ca7d00ac3f3fe515c03ab
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-04-17T12:51:59+02:00
Commit Message:
AGOS: Don't use any unnecessary loop in alignTableMem()
When changing it to fix compatibility with strict-alignment architectures,
I switched it using a loop, but there's actually no need for this. It's
possible to achieve the same results with fewer instructions.
Change tested on the mips64el device where I used to have the alignment
issues, and on an x86 -fsanitize=alignment build.
Related to my own previous commit 3c3d35dafe44bd705ee05d9e5959cd1165c9d2c5.
Changed paths:
engines/agos/subroutine.cpp
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index 738744d7984..579dd2b4fb4 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -218,9 +218,12 @@ Subroutine *AGOSEngine::getSubroutineByID(uint subroutineId) {
}
void AGOSEngine::alignTableMem() {
- while (!IS_ALIGNED(_tablesHeapPtr, sizeof(byte *))) {
- _tablesHeapPtr++;
- _tablesHeapCurPos++;
+ ptrdiff_t delta;
+
+ if (!IS_ALIGNED(_tablesHeapPtr, sizeof(byte *))) {
+ delta = -(ptrdiff_t)_tablesHeapPtr & (sizeof(byte *) - 1);
+ _tablesHeapPtr += delta;
+ _tablesHeapCurPos += delta;
}
}
More information about the Scummvm-git-logs
mailing list