diff --git a/ChangeLog b/ChangeLog index ef0c15f4b..0972348fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2018-02-05 Richard Frith-Macdonald * Source/NSPortCoder.m: Remove redundant (always true) conditional. + Use cast to mask 64bit values. * Source/NSUnarchiver.m: Remove redundant (always true) conditional. * Source/NSPropertyList.m: Remove dead code * Source/NSDecimal.m: Remove dead code diff --git a/Source/NSPortCoder.m b/Source/NSPortCoder.m index 423ef4501..d5a28bfae 100644 --- a/Source/NSPortCoder.m +++ b/Source/NSPortCoder.m @@ -1205,21 +1205,21 @@ scalarSize(char type) switch (size) { case 1: - if (big & ~0xff) + if (big & (uint64_t)~0xff) { NSLog(@"Loss of information converting decoded value to uint8_t"); } *(uint8_t*)address = (uint8_t)big; return; case 2: - if (big & ~0xffff) + if (big & (uint64_t)~0xffff) { NSLog(@"Loss of information converting decoded value to uint16_t"); } *(uint16_t*)address = (uint16_t)big; return; case 4: - if (big & ~0xffffffff) + if (big & (uint64_t)~0xffffffff) { NSLog(@"Loss of information converting decoded value to uint32_t"); }