lua-users home
lua-l archive

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


On Fri, Sep 22, 2006 at 10:58:05PM +0200, Mike Pall wrote:
>   y = math.bitor(x1, x2)
> 
>   y = math.bitand(x1 [, x2])   x2 = -1 if omitted (i.e. tobit)
> 
>   y = math.bitxor(x1 [, x2])   x2 = -1 if omitted (i.e. bitnot)

This seems useful, too, though:

math.bitor(BIT1, BIT2, BIT3, BIT4, BIT5)

That means "A|B|C|D" doesn't become an ugly nest of calls.  It's
conceptually incompatible, I think, with the -1 default, though.
(On first impression, I don't like the idea of calling "xor(n)"
and getting ~n, though ...)

-- 
Glenn Maynard