lua-users home
lua-l archive

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


On Tue, Nov 23, 2010 at 7:14 AM, Patrick Rapin <toupie300@gmail.com> wrote:
> bit32.get(x, disp [, nbbits]) : returns the bit slice taken from
> number 'x', starting at bit # 'disp', and of size 'nbbits' bits (1 by
> default).
>
> bit32.set(val, x, disp [, nbbits]) : inserts the value 'val' as a bit
> slice into number 'x', starting at bit position 'disp', and of size
> 'nbbits' bits (1 by default). The number 'val' must be an integer
> between 0 and 2^nbbits-1.
>
> Sure, these functions can be written in terms of bit32.band,
> bit32.lshift, bit32.rshift and bit32.bor. But would they not be better
> implemented in C inside the library?
>
I like it.

+1

-- 
Nilson