From a0decd4a79684a8a8a88ce9fc5e0c35e663bd35b Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Mon, 6 Oct 2014 20:54:17 +0000 Subject: [PATCH] + ttai_typedconstbuilder.emit_ord_const() helper git-svn-id: branches/hlcgllvm@28775 - --- compiler/aasmcnst.pas | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/compiler/aasmcnst.pas b/compiler/aasmcnst.pas index 4a127a72eb..0611aafea1 100644 --- a/compiler/aasmcnst.pas +++ b/compiler/aasmcnst.pas @@ -230,6 +230,8 @@ type function emit_shortstring_const(const str: shortstring): tdef; { emit a guid constant } procedure emit_guid_const(const guid: tguid); + { emit an ordinal constant } + procedure emit_ord_const(value: int64; def: tdef); { begin a potential aggregate type. Must be called for any type that consists of multiple tai constant data entries, or that @@ -1051,6 +1053,23 @@ implementation end; + procedure ttai_typedconstbuilder.emit_ord_const(value: int64; def: tdef); + begin + case def.size of + 1: + emit_tai(Tai_const.Create_8bit(byte(value)),def); + 2: + emit_tai(Tai_const.Create_16bit(word(value)),def); + 4: + emit_tai(Tai_const.Create_32bit(longint(value)),def); + 8: + emit_tai(Tai_const.Create_64bit(value),def); + else + internalerror(2014100501); + end; + end; + + procedure ttai_typedconstbuilder.maybe_begin_aggregate(def: tdef); begin begin_aggregate_internal(def,false);