lua-users home
lua-l archive

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


On Thu, Sep 21, 2006 at 12:21:13PM +0100, Paul Hudson wrote:
> Bitwise operations would come in very useful for doing interesting things on
> phones (implementing some Internet protocols, munging with addresses/masks
> as has previously been mentioned)

You don't need bitwise operators to get bitwise operations, though.  What's
wrong, in your case, with having them as functions?

  netmask = math.or(netmask, 0x000000FF)

doesn't seem any worse to me than

  netmask = netmask | 0x000000FF

and

  flag = math.set(flag, 10)

is actually clearer, in my opinion, than

  flag = flag | (1<<10)

-- 
Glenn Maynard