From 878ee3f13b4fc6213cdb5ede766c39644f153195 Mon Sep 17 00:00:00 2001 From: dcode Date: Fri, 8 Mar 2019 22:08:28 +0100 Subject: [PATCH] fix --- std/assembly/internal/runtime.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/std/assembly/internal/runtime.ts b/std/assembly/internal/runtime.ts index cd9d018d..efe87985 100644 --- a/std/assembly/internal/runtime.ts +++ b/std/assembly/internal/runtime.ts @@ -14,7 +14,7 @@ export class HEADER { } /** Size of the common runtime header. */ -@inline export const HEADER_SIZE: usize = (offsetof() + AL_MASK) & ~AL_MASK; +@inline export const HEADER_SIZE: usize = (offsetof
() + AL_MASK) & ~AL_MASK; /** Magic value used to validate common headers. */ @inline export const HEADER_MAGIC: usize = 0xA55E4B17; @@ -131,7 +131,7 @@ export function REGISTER(ref: usize): void { // === String ===================================================================================== /** Size of a string header, excl. common runtime header. */ -@inline export const STRING_HEADER_SIZE: usize = (offsetof() + AL_MASK) & ~AL_MASK; +@inline export const STRING_HEADER_SIZE: usize = (offsetof() + 1) & ~1; // 2 byte aligned /** Allocates a new String and returns a pointer to it. */ @inline export function ALLOC_STRING(length: u32): String { @@ -142,3 +142,5 @@ export function REGISTER(ref: usize): void { @inline export function REALLOC_STRING(ref: usize, length: u32): String { return changetype(REALLOC(ref, STRING_HEADER_SIZE + (length << 1))); } + +// ...