diff --git a/compiler/ncon.pas b/compiler/ncon.pas index 007c75f423..3814a4870f 100644 --- a/compiler/ncon.pas +++ b/compiler/ncon.pas @@ -202,7 +202,10 @@ interface cguidconstnode : tguidconstnodeclass = tguidconstnode; cnilnode : tnilnodeclass=tnilnode; - function genintconstnode(const v : TConstExprInt) : tordconstnode; + { Creates tordconstnode with the smallest possible int type which can hold v } + function genintconstnode(const v : TConstExprInt) : tordconstnode; overload; + { Creates tordconstnode with the preferredinttype type or a bigger type which can hold v } + function genintconstnode(const v : TConstExprInt; preferredinttype : tdef) : tordconstnode; overload; function genenumnode(v : tenumsym) : tordconstnode; { some helper routines } @@ -233,6 +236,17 @@ implementation end; + function genintconstnode(const v : TConstExprInt; preferredinttype : tdef) : tordconstnode; + var + htype : tdef; + begin + int_to_type(v,htype); + if htype.size