]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Offsetting builtins so we can use 'if builtin!=0' as condition but also allow a ...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 23:36:24 +0000 (00:36 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 23:36:24 +0000 (00:36 +0100)
ir.c
parser.c

diff --git a/ir.c b/ir.c
index bf08a5d426a8d874128905d1f9120056d8bccf7a..b564baec0b36a44dc1ad4aa87f0cfa816c2c7697 100644 (file)
--- 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);
index f6a3024ac8cddf19579af604944ff18747eff81e..1a5c42790455aef96c556a31c5c3d0cf3b2b7140 100644 (file)
--- 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)) {