Fix memory safety issue

db4
Slava Pestov 2008-01-12 21:38:22 -05:00
parent e3416ec170
commit 2fd1899d84
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -10,7 +10,7 @@ arrays namespaces io ;
] if ; inline ] if ; inline
: (nsieve) ( count i seq -- count ) : (nsieve) ( count i seq -- count )
2dup length <= [ 2dup length < [
2dup nth-unsafe [ 2dup nth-unsafe [
over dup 2 * pick clear-flags over dup 2 * pick clear-flags
rot 1+ -rot ! increment count rot 1+ -rot ! increment count