Skip to content

Commit

Permalink
Disable idiv division by zero check with nochecks pragma
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Aug 4, 2024
1 parent 4b2c75f commit b24ce01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lualib/nelua/cbuiltins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ function cbuiltins.nelua_idiv_(context, type, checked)
local emitter = CEmitter(context)
emitter:add_ln('{') emitter:inc_indent()
emitter:add_indent_ln('if(NELUA_UNLIKELY(b == -1)) return 0U - (', utype ,')a;')
if not checked then
if checked then
emitter:add_indent_ln('if(NELUA_UNLIKELY(b == 0)) nelua_panic_cstring("division by zero");')
end
emitter:add_indent_ln(stype,' q = a / b;')
Expand Down

0 comments on commit b24ce01

Please sign in to comment.