summary refs log tree commit diff stats
path: root/compiler/ccgexprs.nim
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2019-02-12 22:00:31 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-02-13 23:30:14 +0100
commit28394153aba1e1ec0410406392e26e1e7e2e681e (patch)
tree0f2f455db7375b8e2c1e57b56a7f7d950d955bab /compiler/ccgexprs.nim
parent304b1dd34bc52df29528c2a12f769cb59904db5a (diff)
downloadNim-28394153aba1e1ec0410406392e26e1e7e2e681e.tar.gz
32 bit fixes (#10608)
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r--compiler/ccgexprs.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index fb2fd89a3..8ccca9813 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -1997,6 +1997,11 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
   of mSizeOf:
     let t = e.sons[1].typ.skipTypes({tyTypeDesc})
     putIntoDest(p, d, e, "((NI)sizeof($1))" % [getTypeDesc(p.module, t)])
+  of mAlignOf:
+    let t = e.sons[1].typ.skipTypes({tyTypeDesc})
+    if not p.module.compileToCpp:
+      p.module.includeHeader("<stdalign.h>")
+    putIntoDest(p, d, e, "((NI)alignof($1))" % [getTypeDesc(p.module, t)])
   of mChr: genSomeCast(p, e, d)
   of mOrd: genOrd(p, e, d)
   of mLengthArray, mHigh, mLengthStr, mLengthSeq, mLengthOpenArray: