--- deliantra/server/include/util.h 2007/02/15 15:43:36 1.37 +++ deliantra/server/include/util.h 2007/03/01 12:28:16 1.39 @@ -50,11 +50,17 @@ // lots of stuff taken from FXT /* Rotate right. This is used in various places for checksumming */ -//TODO: this sucks, use a better checksum algo +//TODO: that sucks, use a better checksum algo static inline uint32_t -rotate_right (uint32_t c) +rotate_right (uint32_t c, uint32_t count = 1) { - return (c << 31) | (c >> 1); + return (c << (32 - count)) | (c >> count); +} + +static inline uint32_t +rotate_left (uint32_t c, uint32_t count = 1) +{ + return (c >> (32 - count)) | (c << count); } // Return abs(a-b) @@ -395,7 +401,7 @@ void erase (T *obj) { assert (obj->*index); - int pos = obj->*index; + unsigned int pos = obj->*index; obj->*index = 0; if (pos < this->size ())