aboutsummaryrefslogtreecommitdiff
path: root/engines/cge2/vga13h.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cge2/vga13h.cpp')
-rw-r--r--engines/cge2/vga13h.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp
index 54f5c00d93..8b0d8b6c77 100644
--- a/engines/cge2/vga13h.cpp
+++ b/engines/cge2/vga13h.cpp
@@ -952,8 +952,9 @@ uint8 Vga::closest(Dac *pal, const uint8 colR, const uint8 colG, const uint8 col
}
uint8 Vga::closest(Dac *pal, Dac x) {
- int exp = (sizeof(long) * 8 - 1);
- long D = (1 << exp) - 1; // Maximum value of long.
+ long D = 0;
+ D = ~D;
+ D = (unsigned long)D >> 1; // Maximum value of long.
long R = x._r;
long G = x._g;
long B = x._b;