]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix memory safety issue
authorSlava Pestov <slava@factorcode.org>
Sun, 13 Jan 2008 02:38:22 +0000 (21:38 -0500)
committerSlava Pestov <slava@factorcode.org>
Sun, 13 Jan 2008 02:38:22 +0000 (21:38 -0500)
extra/benchmark/nsieve-bits/nsieve-bits.factor
extra/benchmark/nsieve/nsieve.factor

index c2f8e02996f0889419d00d7cba1397746971286d..46ebc6595e6487b10abab4f25f61e39fc4d36f04 100644 (file)
@@ -6,11 +6,11 @@ bit-arrays namespaces io ;
     2dup length >= [
         3drop
     ] [
-        f pick pick set-nth-unsafe >r over + r> clear-flags
+        f 2over set-nth-unsafe >r over + r> clear-flags
     ] if ; inline
 
 : (nsieve-bits) ( count i seq -- count )
-    2dup length <= [
+    2dup length < [
         2dup nth-unsafe [
             over dup 2 * pick clear-flags
             rot 1+ -rot ! increment count
index b9200fb2bbdc4e84717a88c563b1b25edbaa42f1..c567aa8a8f8122b58a8ce70a6f7dbe0ab584a8ce 100644 (file)
@@ -10,7 +10,7 @@ arrays namespaces io ;
     ] if ; inline
 
 : (nsieve) ( count i seq -- count )
-    2dup length <= [
+    2dup length < [
         2dup nth-unsafe [
             over dup 2 * pick clear-flags
             rot 1+ -rot ! increment count