From addb99eff250af2af0241442d45ff3d23434e6f1 Mon Sep 17 00:00:00 2001 From: jtenner Date: Wed, 12 Jun 2019 15:16:48 -0400 Subject: [PATCH] Improve offsetof typings (#659) --- std/assembly/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 2bba7613..02b7ccde 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -110,6 +110,10 @@ declare const __heap_base: usize; declare function sizeof(): usize; /** Determines the alignment (log2) of the specified underlying core type. Compiles to a constant. */ declare function alignof(): usize; +/** Determines the end offset of the given class type. Compiles to a constant. */ +declare function offsetof(): usize; +/** Determines the offset of the specified field within the given class type. Compiles to a constant. */ +declare function offsetof(fieldName: keyof T | string): usize; /** Determines the offset of the specified field within the given class type. Returns the class type's end offset if field name has been omitted. Compiles to a constant. */ declare function offsetof(fieldName?: string): usize; /** Determines the unique runtime id of a class type. Compiles to a constant. */