[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (alpha-rc3) now available
- From: Miles Bader <miles@...>
- Date: Wed, 24 Nov 2010 09:44:51 +0900
Patrick Rapin <toupie300@gmail.com> writes:
> I call them get and set. We used them quite a lot to deal with bit
> fields from hardware registers. This is how they could be defined:
>
> 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.
I think the "traditional" names for these operations (e.g., instruction
names on CPUs that have such operations) are "extract" and "insert".
[And I think those names are more clear than "get" and "set"]
-Miles
--
Omochiroi!