Re: Probably a bug in LuaJIT x86

  • From: Egor Skriptunoff <egor.skriptunoff@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 16 Aug 2018 23:20:01 +0300

On Thu, Aug 16, 2018 at 10:54 AM, Mike Pall wrote:

Compilation warning is displayed when building latest LuaJIT 2.1 under
VS2010:
   lib_base.c(302) : warning C4146: unary minus operator applied to
unsigned type, result still unsigned

The workaround to silence that warning with an intermediate cast
to a signed type may cause warnings from other tools about
potentially undefined behavior (negation of 0x80000000). Which
doesn't happen in practice, but the tools can't infer that.



Are the following two statements equivalent?
ul = -ul
ul = 1 + ~ul

Other related posts: