[Scummvm-git-logs] scummvm master -> 84a52c387609cd07c1643a0dea6a03f7f9110f41

sev- noreply at scummvm.org
Wed Nov 13 00:44:44 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
84a52c3876 QDENGINE: Fix warning about potentially unaligned access


Commit: 84a52c387609cd07c1643a0dea6a03f7f9110f41
    https://github.com/scummvm/scummvm/commit/84a52c387609cd07c1643a0dea6a03f7f9110f41
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-13T01:44:36+01:00

Commit Message:
QDENGINE: Fix warning about potentially unaligned access

Changed paths:
    engines/qdengine/xmath.h


diff --git a/engines/qdengine/xmath.h b/engines/qdengine/xmath.h
index 2fde950d920..e411e4daa73 100644
--- a/engines/qdengine/xmath.h
+++ b/engines/qdengine/xmath.h
@@ -64,9 +64,11 @@ const int INT_INF = 0x7fffffff;
 inline float invSqrtFast(float x) {
 	x += 1e-7f; // Добавка, устраняющая деление на 0
 	float xhalf = 0.5f * x;
-	int i = *(int *)&x; // get bits for floating value
+
+	uint32 i;
+	memcpy(&i, &x, 4);
 	i = 0x5f375a86 - (i >> 1); // gives initial guess y0
-	x = *(float *)&i; // convert bits back to float
+	memcpy(&x, &i, 4);
 	x = x * (1.5f - xhalf * x * x); // Newton step, repeating increases accuracy
 	return x;
 }




More information about the Scummvm-git-logs mailing list