|
From: | simon schuler |
Subject: | [glob2-devel] Bug in Map.cpp Checksum computation |
Date: | Tue, 25 Jan 2005 02:21:57 +0000 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041229 |
Sint32 Map::checkSum(bool heavy) { Sint32 cs=size; if (heavy) for (int y=0; y<h; y++) for (int x=0; x<w; x++) { ... cs=(cs<<1)|(cs>>31); } return cs; }The rotate Statement cs=(cs<<1)|(cs>>31); is wrong for signed integers and will overwrite the whole integer with 0xFFFFFFFF when cs is negative. Game.cpp expects an Uint32 as return type anyway, so we just have to change the type of cs to Uint32, and make Map::checkSum return an Uint32. After changing this, it returned usable values...
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |