ProcessTick
#12

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
pawn Код:
if(!(s_iTicks++ % MAX_TICKS))

}
Does the % operator get affected by integer / variable overflows?

I mean look at this..
Код:
[16:51:04] 2147483630 1
[16:51:04] 2147483631 0
[16:51:04] 2147483632 0
[16:51:04] 2147483633 0
[16:51:04] 2147483634 0
[16:51:04] 2147483635 0
[16:51:04] 2147483636 0
[16:51:04] 2147483637 0
[16:51:04] 2147483638 0
[16:51:04] 2147483639 0
[16:51:04] 2147483640 1
[16:51:04] 2147483641 0//1
[16:51:04] 2147483642 0//2
[16:51:04] 2147483643 0//...
[16:51:04] 2147483644 0
[16:51:04] 2147483645 0
[16:51:04] 2147483646 0
[16:51:04] 2147483647 0
[16:51:04] -- 0//WTF?
[16:51:04] -2147483647 0
[16:51:04] -2147483646 0
[16:51:04] -2147483645 0
[16:51:04] -2147483644 0
[16:51:04] -2147483643 0
[16:51:04] -2147483642 0
[16:51:04] -2147483641 0//15 instead of 10
[16:51:04] -2147483640 1
[16:51:04] -2147483639 0
[16:51:04] -2147483638 0
[16:51:04] -2147483637 0
[16:51:04] -2147483636 0
[16:51:04] -2147483635 0
[16:51:04] -2147483634 0
[16:51:04] -2147483633 0
[16:51:04] -2147483632 0
[16:51:04] -2147483631 0
[16:51:04] -2147483630 1
[16:51:04] -2147483629 0
[16:51:04] -2147483628 0
[16:51:04] -2147483627 0
[16:51:04] -2147483626 0
[16:51:04] -2147483625 0
[16:51:04] -2147483624 0
[16:51:04] -2147483623 0
[16:51:04] -2147483622 0
[16:51:04] -2147483621 0
[16:51:04] -2147483620 1
[16:51:04] -2147483619 0
[16:51:04] -2147483618 0
[16:51:04] -2147483617 0
[16:51:04] -2147483616 0
[16:51:04] -2147483615 0
[16:51:04] -2147483614 0
[16:51:04] -2147483613 0
[16:51:04] -2147483612 0
[16:51:04] -2147483611 0
[16:51:04] -2147483610 1
[16:51:04] -2147483609 0
[16:51:04] -2147483608 0
[16:51:04] -2147483607 0
[16:51:04] -2147483606 0
[16:51:04] -2147483605 0
[16:51:04] -2147483604 0
[16:51:04] -2147483603 0
[16:51:04] -2147483602 0
[16:51:04] -2147483601 0
[16:51:04] -2147483600 1
[16:51:04] -2147483599 0
[16:51:04] -2147483598 0
[16:51:04] -2147483597 0
[16:51:04] -2147483596 0
[16:51:04] -2147483595 0
[16:51:04] -2147483594 0
[16:51:04] -2147483593 0
[16:51:04] -2147483592 0
[16:51:04] -2147483591 0
[16:51:04] -2147483590 1
[16:51:04] -2147483589 0
[16:51:04] -2147483588 0
[16:51:04] -2147483587 0
[16:51:04] -2147483586 0
[16:51:04] -2147483585 0
[16:51:04] -2147483584 0
[16:51:04] -2147483583 0
[16:51:04] -2147483582 0
[16:51:04] -2147483581 0
[16:51:04] -2147483580 1
[16:51:04] -2147483579 0
[16:51:04] -2147483578 0
[16:51:04] -2147483577 0
[16:51:04] -2147483576 0
[16:51:04] -2147483575 0
[16:51:04] -2147483574 0
[16:51:04] -2147483573 0
[16:51:04] -2147483572 0
[16:51:04] -2147483571 0
[16:51:04] -2147483570 1
[16:51:04] -2147483569 0
[16:51:04] -2147483568 0
[16:51:04] -2147483567 0
with:
pawn Код:
for (new i = 0; i < 100; i++)
        printf("%d %b", 2147483630 + i, ((2147483630 + i) % 10) ==0);
If it affects pawn it does C++ too.. or am I wrong?

Also I think == is faster than %.. (I know it's not really a big deal but anyway..)
Reply


Messages In This Thread
ProcessTick - by Scottas - 07.09.2011, 19:01
Re: ProcessTick - by Gamer_Z - 07.09.2011, 19:43
Re: ProcessTick - by Tony_Montana - 07.09.2011, 21:19
Re: ProcessTick - by Scottas - 08.09.2011, 06:58
Re: ProcessTick - by Gamer_Z - 08.09.2011, 13:31
Re: ProcessTick - by snoob - 24.02.2012, 00:08
Re: ProcessTick - by Gamer_Z - 24.02.2012, 15:12
Re: ProcessTick - by T0pAz - 24.02.2012, 15:16
Re: ProcessTick - by RyDeR` - 24.02.2012, 17:09
Re: ProcessTick - by Gamer_Z - 24.02.2012, 18:32
Re: ProcessTick - by snoob - 24.02.2012, 23:07
Re: ProcessTick - by Gamer_Z - 27.02.2012, 14:50
Re: ProcessTick - by Gamer_Z - 27.02.2012, 15:23
Re: ProcessTick - by Gamer_Z - 27.02.2012, 16:17

Forum Jump:


Users browsing this thread: 1 Guest(s)