Re: ffi.cast: weird behaviour

  • From: Daurnimator <quae@xxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 22 Nov 2013 08:58:20 +0100

On 22 November 2013 04:46, Mike Pall <mike-1311@xxxxxxxxxx> wrote:

> Daurnimator wrote:
> > This is what I ended up with:
> https://gist.github.com/daurnimator/7582543
> > Hopefully I didn't overlook anything else...
>
> Wrong mantissa condition, use of uint32_t, endianess issues,
> efficiency issues.
>

Thanks :)
What is wrong with using unsigned here (just performance?)
What was incorrect about my previous mantissa condition?

  local lohi_p = ffi.typeof("struct { int32_t "..(ffi.abi("le") and "lo,
> hi" or "hi, lo").."; } *")
>

Nice trick for an endianess fix :)
Will have to remember this.

I've updated the gist with your code, thanks again for the supervision!

Other related posts: