From a1ebc7090d16229106a25de86bab03cf13d04992 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 18 Apr 2024 22:22:29 +0200 Subject: [PATCH] fix sieve example --- README.md | 2 +- docs/source/index.rst | 2 +- examples/primes.p8 | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1394f2d88..4f83aeb02 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm:: %import textio %zeropage basicsafe - + main { bool[256] sieve ubyte candidate_prime = 2 ; is increased in the loop diff --git a/docs/source/index.rst b/docs/source/index.rst index 26435e5ef..5b234bbf8 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -120,7 +120,7 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm:: %zeropage basicsafe main { - ubyte[256] sieve + bool[256] sieve ubyte candidate_prime = 2 ; is increased in the loop sub start() { diff --git a/examples/primes.p8 b/examples/primes.p8 index 193a2c953..e6536870f 100644 --- a/examples/primes.p8 +++ b/examples/primes.p8 @@ -4,12 +4,11 @@ ; Note: this program can be compiled for multiple target systems. main { - bool[256] sieve ubyte candidate_prime = 2 ; is increased in the loop sub start() { - sys.memset(sieve, 256, 0) ; clear the sieve, to reset starting situation on subsequent runs + sys.memset(sieve, 256, 0) ; clear the sieve ; calculate primes txt.print("prime numbers up to 255:\n\n") @@ -26,8 +25,6 @@ main { txt.print("number of primes (expected 54): ") txt.print_ub(amount) txt.nl() - - ; test_stack.test() }