[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: boolean operators
- From: "Grellier, Thierry" <t-grellier@...>
- Date: Thu, 21 Sep 2006 12:33:46 +0200
OK, well let's say why I use a patch for bitwise operators on lua 5.1.1.
I write traffic generators generating requests including addresses. That
is I often apply a mask on the address to bind it to a range. I could do
if < base+range then restart from base, but this is many opcodes, and
lead even to make a function (hence a call).
But this is not only range I deal with, there is also address alignment.
For example I generate random addresses, then bound them to a range,
than align the address on memory (with clearing last bits, either a
shift or another mask). Again this is feasible with language, but
Then I deal with responses, where it is still less memory expensive to
preserve them as numbers with bitfields and limits conversion needs.
Maybe this is not mainstream usage, but still when you want to use a
script language to test a protocol, I think this is a stopper not having
PS: for those interested, I've posted the patch in the list a few months
[mailto:firstname.lastname@example.org] On Behalf Of Roberto
Sent: Wednesday, September 20, 2006 10:52 PM
To: Lua list
Subject: Re: boolean operators
> Actually, I think he was just talking about needing to use 'and', 'or'
> 'not' instead of '&&', '||', and '!' --- Lua *has* boolean operators.
> But I think you were talking about logical operators, which stock Lua
> have, [...]
Sure. Sorry about the confusion. (I should call them bitwise operators.)