lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 8 December 2016 at 18:46, Sean Conner <sean@conman.org> wrote:
> It was thus said that the Great Roberto Ierusalimschy once stated:
>> > I have been thinking of ways of making the Ravi interpreter faster
>> > without having to resort to assembly code etc. So far one of the areas
>> > I have not really looked at is how to improve the bytecode decoding.
>> > The main issue is that the operands B and C require an extra bit
>> > compared to operand A, so we cannot make them all 8 bits...
>>
>> Given a 32- or 64-bit machine, why decoding 8-bit operands would be
>> faster/better than 9-bit ones?
>
>   I would think less shifting, but not being 100% sure, I decided to test my
> assumptions.  I wrote:
>
> void split8(unsigned int *dest,unsigned int op)
> {
>   dest[0] = (op >> 24) & 0xFF;
>   dest[1] = (op >> 16) & 0xFF;
>   dest[2] = (op >>  8) & 0xFF;
>   dest[3] = (op      ) & 0xFF;
> }
>

Perhaps one of the masks could be eliminated?

Regards