|
Post by rosy on Feb 14, 2021 16:07:25 GMT -6
From what I can see, it doesn't check if positive or negative, it only checks if negative twice ...
|
|
|
Post by n00b on Feb 14, 2021 17:52:42 GMT -6
Look closer at line 6 in the code I posted. It has a "!" at the start of the else if. In C++ the "!" is the NOT operator.
|
|
|
Post by rosy on Feb 15, 2021 5:03:43 GMT -6
And ... I didn't notice ... And what is the new procedure?
|
|
|
Post by n00b on Feb 15, 2021 9:42:43 GMT -6
I am still making changes. It will be available on github when the next release is available.
|
|
|
Post by rosy on Feb 15, 2021 10:47:18 GMT -6
But I still don't understand why this loop went on forever ...
|
|
|
Post by n00b on Feb 15, 2021 10:59:14 GMT -6
I can give a brief explanation but I don't want to get to technical as it could end up 3 pages.
Lets say you have this for loop:
For i = 5 to 4 Next
In this loop, the default STEP of 1 will be used. The isNegative Flag of the FOR loop will be true.
Once it goes through each iteration it will get to this code:
if(loop_stack.top().isNegative && (loop_stack.top().counter[0].nid_value[0].value[0] + loop_stack.top().f_step) >= loop_stack.top().f_end)
isNegative will be true. The second part adds the current counter and the step which in this case is (5+1) which equals 6. It then checks if 6 is greater than or equal to the end condition which is 4. If it is greater then it jumps back to the start of the FOR loop. Since the STEP positive it will never get to a point where the counter is less than the start condition.
If the step was negative it would only run 2 times through the loop.
|
|
|
Post by rosy on Feb 16, 2021 14:37:43 GMT -6
What does "is Negative" mean?
|
|
|
Post by n00b on Feb 17, 2021 21:25:55 GMT -6
Its a flag that is set when the for loop starts. It is based on whether the start condition is greater than or less than the end condition.
|
|
|
Post by aurel on Feb 18, 2021 6:57:28 GMT -6
well .. i understand even i am not C/C++ programmer ...and looks to me very good i mean easy to understand for_loop_stack
|
|
|
Post by rosy on Feb 18, 2021 15:36:58 GMT -6
I understand that you relied on STEP in the new version...
You can also do, for example:
FOR I = START TO END STEP ST
IF SIGN (ST) * END > SIGN (ST) * I I + = ST ELSE EXIT FOR ENDIF
Do you check the speed on Android?
|
|
|
Post by n00b on Feb 20, 2021 10:17:31 GMT -6
Android speed is going to be the same its always been.
|
|
|
Post by rosy on Sept 26, 2021 4:02:36 GMT -6
FOR still works bad ...
|
|
|
Post by n00b on Sept 26, 2021 6:57:23 GMT -6
What is bad about it?
|
|
|
Post by rosy on Sept 26, 2021 9:18:48 GMT -6
Same. Execute when start> end.
|
|
|
Post by n00b on Sept 26, 2021 10:22:08 GMT -6
Can you share an example of where its happening?
|
|