← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/markos-scratch into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/92732

small optimization for subsequence iterators
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/92732
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/sequences/sequences_impl.cpp'
--- src/runtime/sequences/sequences_impl.cpp	2012-01-20 21:48:24 +0000
+++ src/runtime/sequences/sequences_impl.cpp	2012-02-13 10:39:33 +0000
@@ -493,13 +493,21 @@
       goto done;
   }
 
-  while ((theChildren.size() < 3 || state->theRemaining > 0) &&
-         CONSUME(result, 0))
-  {
-    if (theChildren.size () >= 3)
+  if (theChildren.size() < 3)
+  {
+    while (CONSUME(result, 0))
+    {
+      STACK_PUSH(true, state);
+    }
+  }
+  else
+  {
+    while (state->theRemaining > 0 && CONSUME(result, 0))
+    {
       state->theRemaining--;
-
-    STACK_PUSH (true, state);
+      
+      STACK_PUSH(true, state);
+    }
   }
 
 done:
@@ -571,13 +579,21 @@
       goto done;
   }
 
-  while ((theChildren.size() < 3 || state->theRemaining > 0) &&
-         CONSUME(result, 0))
-  {
-    if (theChildren.size () >= 3)
+  if (theChildren.size() < 3)
+  {
+    while (CONSUME(result, 0))
+    {
+      STACK_PUSH(true, state);
+    }
+  }
+  else
+  {
+    while (state->theRemaining > 0 && CONSUME(result, 0))
+    {
       state->theRemaining--;
 
-    STACK_PUSH (true, state);
+      STACK_PUSH(true, state);
+    }
   }
 
 done:
@@ -587,6 +603,7 @@
   STACK_END(state);
 }
 
+
 /*******************************************************************************
   zorbaop:sequence-point-access
 ********************************************************************************/


Follow ups