From 9fb9bbb3e2700f55cc14c7b7d8dd45b263cf99ca Mon Sep 17 00:00:00 2001 From: Daniel_Cortez Date: Sun, 25 Nov 2018 19:24:29 +0700 Subject: [PATCH] __emit: Allow expressions for arguments of type 'shift' --- source/compiler/sc1.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/compiler/sc1.c b/source/compiler/sc1.c index 4d92d2a..1f9a9e0 100644 --- a/source/compiler/sc1.c +++ b/source/compiler/sc1.c @@ -6441,10 +6441,11 @@ static void SC_FASTCALL emit_parm1_nonneg(char *name) static void SC_FASTCALL emit_parm1_shift(char *name) { - static const cell valid_values[] = { 0,sizeof(cell)*8-1 }; emit_outval p[1]; - emit_param_index(&p[0],TRUE,valid_values,(sizeof valid_values / sizeof valid_values[0])); + if (emit_param_any_internal(&p[0],tNUMBER,FALSE,TRUE)) + if (p->value.ucell>=(sizeof(cell)*8)) + error(50); /* invalid range */ outinstr(name,p,(sizeof p / sizeof p[0])); }