Skip to content

Commit 4349eeb

Browse files
Merge pull request #495 from Wuerfel21/W21-gcalloc-no-signed-divide
Remove signed divides from gcalloc
2 parents 1fc8539 + 924b53f commit 4349eeb

File tree

2 files changed

+643
-642
lines changed

2 files changed

+643
-642
lines changed

sys/gcalloc.spin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pri _gc_ptrs : base, end | size
105105
word[base + OFF_PREV] := 0
106106
word[base + OFF_LINK] := 1
107107
base += pagesize
108-
word[base + OFF_SIZE] := (size / pagesize)
108+
word[base + OFF_SIZE] := (size >> pagesizeshift)
109109
word[base + OFF_FLAGS] := GC_MAGIC | GC_FLAG_FREE
110110
word[base + OFF_PREV] := 0
111111
word[base + OFF_LINK] := 0
@@ -223,7 +223,7 @@ pri _gc_doalloc(size, reserveflag) : ptr
223223

224224
if ptr
225225
' zero the returned memory
226-
size := ((size << pagesizeshift) - headersize)/4
226+
size := ((size << pagesizeshift) - headersize)>>2
227227
longfill(ptr, 0, size)
228228
return ptr
229229

0 commit comments

Comments
 (0)