[Scummvm-git-logs] scummvm master -> 7ebbb12dfb77d82958390ee71801bc900961d10f

bonki bonki at users.noreply.github.com
Mon May 7 22:21:46 CEST 2018


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:
7ebbb12dfb SCUMM: Remove superfluous 'else' in IMuseInternal::ImSetTrigger()


Commit: 7ebbb12dfb77d82958390ee71801bc900961d10f
    https://github.com/scummvm/scummvm/commit/7ebbb12dfb77d82958390ee71801bc900961d10f
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-05-07T22:21:42+02:00

Commit Message:
SCUMM: Remove superfluous 'else' in IMuseInternal::ImSetTrigger()

Both means to calculate `diff` are essentially equal because
wraparound of unsigned integers is well-defined and does what
the 'else' branch is simulating manually. Because of this,
gcc complains when compiling with -Wduplicated-branches.

Changed paths:
    engines/scumm/imuse/imuse.cpp


diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index 5de921b..f5526ab 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -1236,11 +1236,8 @@ int32 IMuseInternal::ImSetTrigger(int sound, int id, int a, int b, int c, int d,
 		if (trig->id == id && trig->sound == sound && trig->command[0] == a)
 			break;
 
-		uint16 diff;
-		if (trig->expire <= _snm_trigger_index)
-			diff = _snm_trigger_index - trig->expire;
-		else
-			diff = 0x10000 - trig->expire + _snm_trigger_index;
+		// The wraparound if trig->expire > _snm_trigger_index is intentional
+		uint16 diff = _snm_trigger_index - trig->expire;
 
 		if (!oldest_ptr || oldest_trigger < diff) {
 			oldest_ptr = trig;





More information about the Scummvm-git-logs mailing list