From 8cbbdedaf4dfec9e320e7e2be58b75d256950df1 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 20 Jul 2020 12:16:20 +0200 Subject: Refactor: Update integer type usage This updates the usage of integer types in code I wrote according to our new style guides. Major changes: * Use signed instead of unsigned integers in many places. * C++ containers in blenlib use `int64_t` for size and indices now (instead of `uint`). * Hash values for C++ containers are 64 bit wide now (instead of 32 bit). I do hope that I broke no builds, but it is quite likely that some compiler reports slightly different errors. Please let me know when there are any errors. If the fix is small, feel free to commit it yourself. I compiled successfully on linux with gcc and on windows. --- source/blender/blenlib/BLI_color.hh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/blender/blenlib/BLI_color.hh') diff --git a/source/blender/blenlib/BLI_color.hh b/source/blender/blenlib/BLI_color.hh index 265013c0013..72caa5b1118 100644 --- a/source/blender/blenlib/BLI_color.hh +++ b/source/blender/blenlib/BLI_color.hh @@ -62,12 +62,12 @@ struct Color4f { return !(a == b); } - uint32_t hash() const + uint64_t hash() const { - uint32_t x1 = *(uint32_t *)&r; - uint32_t x2 = *(uint32_t *)&g; - uint32_t x3 = *(uint32_t *)&b; - uint32_t x4 = *(uint32_t *)&a; + uint64_t x1 = *(uint32_t *)&r; + uint64_t x2 = *(uint32_t *)&g; + uint64_t x3 = *(uint32_t *)&b; + uint64_t x4 = *(uint32_t *)&a; return (x1 * 1283591) ^ (x2 * 850177) ^ (x3 * 735391) ^ (x4 * 442319); } }; @@ -119,10 +119,10 @@ struct Color4b { return !(a == b); } - uint32_t hash() const + uint64_t hash() const { - return ((uint32_t)r * 1283591) ^ ((uint32_t)g * 850177) ^ ((uint32_t)b * 735391) ^ - ((uint32_t)a * 442319); + return ((uint64_t)r * 1283591) ^ ((uint64_t)g * 850177) ^ ((uint64_t)b * 735391) ^ + ((uint64_t)a * 442319); } }; -- cgit v1.2.3