Skip to content

Commit

Permalink
Fixed the heap
Browse files Browse the repository at this point in the history
  • Loading branch information
tabemann committed Jul 8, 2024
1 parent 8512d21 commit da7f4c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/common/forth/heap.fs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ begin-module heap
;

\ Find the last block in a heap
debug-heap? [if]
false [if]
: find-last-block ( heap -- index )
>r r@ heap-next-free @ begin
dup r@ group-size@ 2dup + r@ heap-block-count @ >= if
Expand Down Expand Up @@ -636,7 +636,7 @@ begin-module heap

\ Verify that no memory is allocated after the last free block
: verify-last-block ( heap -- )
[ debug-heap? ] [if]
[ false ] [if]
>r r@ heap-block-count @ r@ find-last-block
dup -1 <> if
cr ." Last block: " dup .
Expand Down Expand Up @@ -758,7 +758,7 @@ begin-module heap

\ Get the size of a heap with a given block size and block count
: heap-size ( block-size block-count -- heap-bytes )
swap cell align 3 cells max over * swap 32 align 5 rshift cells +
32 align swap cell align 3 cells max over * swap 5 rshift cells +
heap-size +
;

Expand Down

0 comments on commit da7f4c2

Please sign in to comment.