[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (rc4) now available
- From: Paige DePol <lual@...>
- Date: Tue, 13 Jan 2015 02:15:56 -0600
Tim Hill <drtimhill@gmail.com> wrote:
>> On Jan 12, 2015, at 2:08 PM, Coda Highland <chighland@gmail.com> wrote:
>>
>> On Mon, Jan 12, 2015 at 2:04 PM, Michael Welsh Duggan <mwd@cert.org> wrote:
>>> Sean Conner <sean@conman.org> writes:
>>>
>>>
>>> 0x1000000000000
>>>
>>> --
>>> Michael Welsh Duggan
>>> (mwd@cert.org)
>>
>> 1 << 48.
>>
>> We have bitops now. :P
>>
>> /s/ Adam
>
> However, as Lua does little (if any) constant folding at compile time, this will be more expensive than the equivalent hex/decimal literal.
>
> —Tim
Lua does constant folding... grep the codebase for 'folding'!
"a = 1 << 5"
Compiles to:
main <ackoop:0,0> (2 instructions at 0x7f8db8405270)
0+ params, 2 slots, 1 upvalue, 0 locals, 2 constants, 0 functions
1 [2] SETTABUP 0 -1 -2 ; _ENV "a" 32
2 [2] RETURN 0 1
constants (2) for 0x7f8db8405270:
1 "a"
2 32
locals (0) for 0x7f8db8405270:
upvalues (1) for 0x7f8db8405270:
0 _ENV 1 0
Looks like it folded "1 << 5" to "32" correctly! :)
~pmd