@@ -660,11 +660,12 @@ function cbuiltins.nelua_idiv_(context, type, checked)
660
660
if context .usedbuiltins [name ] then return name end
661
661
assert (type .is_signed )
662
662
local stype , utype = type :signed_type (), type :unsigned_type ()
663
- context :ensure_builtins (' NELUA_UNLIKELY' , ' nelua_panic_cstring ' )
663
+ context :ensure_builtins (' NELUA_UNLIKELY' )
664
664
local emitter = CEmitter (context )
665
665
emitter :add_ln (' {' ) emitter :inc_indent ()
666
666
emitter :add_indent_ln (' if(NELUA_UNLIKELY(b == -1)) return 0U - (' , utype ,' )a;' )
667
667
if checked then
668
+ context :ensure_builtins (' nelua_panic_cstring' )
668
669
emitter :add_indent_ln (' if(NELUA_UNLIKELY(b == 0)) nelua_panic_cstring("division by zero");' )
669
670
end
670
671
emitter :add_indent_ln (stype ,' q = a / b;' )
@@ -680,11 +681,12 @@ function cbuiltins.nelua_imod_(context, type, checked)
680
681
local name = (checked and ' nelua_assert_imod_' or ' nelua_imod_' ).. type .codename
681
682
if context .usedbuiltins [name ] then return name end
682
683
assert (type .is_signed )
683
- context :ensure_builtins (' NELUA_UNLIKELY' , ' nelua_panic_cstring ' )
684
+ context :ensure_builtins (' NELUA_UNLIKELY' )
684
685
local emitter = CEmitter (context )
685
686
emitter :add_ln (' {' ) emitter :inc_indent ()
686
687
emitter :add_indent_ln (' if(NELUA_UNLIKELY(b == -1)) return 0;' )
687
688
if checked then
689
+ context :ensure_builtins (' nelua_panic_cstring' )
688
690
emitter :add_indent_ln (' if(NELUA_UNLIKELY(b == 0)) nelua_panic_cstring("division by zero");' )
689
691
end
690
692
emitter :add_indent_ln (type ,' r = a % b;' )
0 commit comments