From: Wolfgang (Blub) Bumiller Date: Fri, 30 Nov 2012 23:36:24 +0000 (+0100) Subject: Offsetting builtins so we can use 'if builtin!=0' as condition but also allow a ... X-Git-Tag: 0.1.9~148 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=43c0343755383fdd79e7c402ab316dc561825b15;p=xonotic%2Fgmqcc.git Offsetting builtins so we can use 'if builtin!=0' as condition but also allow a '#0' builtin --- diff --git a/ir.c b/ir.c index bf08a5d..b564bae 100644 --- a/ir.c +++ b/ir.c @@ -2862,7 +2862,7 @@ static bool gen_global_function(ir_builder *ir, ir_value *global) fun.locals = vec_size(code_globals) - fun.firstlocal; if (irfun->builtin) - fun.entry = irfun->builtin; + fun.entry = irfun->builtin+1; else { irfun->code_function_def = vec_size(code_functions); fun.entry = vec_size(code_statements); diff --git a/parser.c b/parser.c index f6a3024..1a5c427 100644 --- a/parser.c +++ b/parser.c @@ -4028,7 +4028,7 @@ skipvar: } vec_push(parser->functions, func); - func->builtin = -parser_token(parser)->constval.i; + func->builtin = -parser_token(parser)->constval.i-1; } if (!parser_next(parser)) {