shithub: mc

Download patch

ref: 72a6efce6e4619af93bea66fdfd1916ebe2d6af1
parent: 90884157987e7d97243f0a44ef75f123c0c83bdb
author: Ori Bernstein <[email protected]>
date: Mon Jan 6 13:00:04 EST 2014

Fix alignment calculations.

--- a/libstd/alloc.myr
+++ b/libstd/alloc.myr
@@ -99,8 +99,8 @@
 	if len == 0
 		-> [][:]
 	;;
-	sz = len*sizeof(@a) + sizeof(slheader)
-	p = bytealloc(align(sz, Align))
+	sz = len*sizeof(@a) + align(sizeof(slheader), Align)
+	p = bytealloc(sz)
 	p = inithdr(p, sz)
 	-> (p castto(@a#))[0:len]
 }
@@ -111,7 +111,7 @@
 	if len == 0
 		-> [][:]
 	;;
-	sz = len*sizeof(@a) + sizeof(slheader)
+	sz = len*sizeof(@a) + align(sizeof(slheader), Align)
 	p = zbytealloc(sz)
 	p = inithdr(p, sz)
 	-> (p castto(@a#))[0:len]