08.09.2009, 04:25
What's the reasoning behind this change? I assume the most common use of GetTickCount is to find the time between two events, but this change will break that functionality. For example if two times are 5 seconds (5000ms) apart, it doesn't matter if the numbers are (if interpreted as signed) negative or positive, subtracting the first from the second will give 5000.
For example:
gives
If the times wrap from 0 to cellmax however, it's possible to get two times which are 5 seconds apart which, when subtracted, give a large negative value.
For example:
gives
For example:
pawn Код:
new first = 0x7FFFF05F,
second = 0x800003E7;
printf("Signed operation\n\t%i - %i = %i", second, first, second - first);
printf("Unsigned operation\n\t%s - %s = %s", ustr(Unsigned:second), ustr(Unsigned:first), ustr(usub(Unsigned:second, Unsigned:first)));
Quote:
[16:16:13] Signed operation -2147482649 - 2147479647 = 5000 [16:16:13] Unsigned operation 2147484647 - 2147479647 = 5000 |
For example:
pawn Код:
new first = 0x7FFFF05F,
second = 0x000003E8;
printf("%i - %i = %i", second, first, second - first);
Quote:
1000 - 2147479647 = -2147478647 |