Please dont change lCountStep! You can try to set "lCountStep = 2" and check the results... one loop the resutls are even and in the next loop they arent... maybe usefull or any special situation....
Looks nice in reading, but use of % have a cost in CPU time I guess.
Rgrds
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
lCountTo = 31 ; Only change the val (max you want to count)
lCountStep = 1
StartTime = GetTickCount_()
For i = 0 To 10000000
lCountResult = (lCountResult % lCountTo) + lCountStep
Debug lCountResult
Next
MessageRequester("Result:",Str(GetTickCount_()-StartTime))
lCountTo = 31 ; Only change the val (max you want to count)
lCountStep = 1
StartTime = GetTickCount_()
For i = 0 To 10000000
lCountResult = lCountResult + lCountStep
If lCountResult > lCountTo
lCountResult = 0
EndIf
Debug lCountResult
Next
MessageRequester("",Str(GetTickCount_()-StartTime))
lCountToMask = %00011111 ; 32 in binary
lCountStep = 1
StartTime = GetTickCount_()
For i = 0 To 10000000
lCountResult = (lCountResult & lCountToMask) + lCountStep
Debug lCountResult
Next
MessageRequester("And Result:",Str(GetTickCount_()-StartTime))
lCountTo = 32 ; Only change the val (max you want to count)
lCountStep = 1
StartTime = GetTickCount_()
For i = 0 To 10000000
lCountResult = (lCountResult % lCountTo) + lCountStep
Debug lCountResult
Next
MessageRequester("Mod Result:",Str(GetTickCount_()-StartTime))
lCountTo = 32 ; Only change the val (max you want to count)
lCountStep = 1
StartTime = GetTickCount_()
For i = 0 To 10000000
lCountResult = lCountResult + lCountStep
If lCountResult > lCountTo
lCountResult = 0
EndIf
Debug lCountResult
Next
MessageRequester("If Result:",Str(GetTickCount_()-StartTime))
lCountTo = 32 ; Only change the val (max you want to count)
#lCountStep = 1
StartTime = GetTickCount_()
For i = 0 To 10000000 / lCountTo
For j = 1 To lCountTo Step #lCountStep
Debug j
Next j
Next i
MessageRequester("For Result:",Str(GetTickCount_()-StartTime))