CGE2: More portable way of getting max long value

This commit is contained in:
Eugene Sandulenko 2016-05-02 17:50:15 +02:00
parent 8a6e5336a6
commit 31514f8164

View File

@ -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;