[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tribool
- From: Leo Razoumov <slonik.az@...>
- Date: Wed, 17 Nov 2010 12:51:45 -0500
On Wed, Nov 17, 2010 at 09:40, Kristofer Karlsson
<kristofer.karlsson@gmail.com> wrote:
> Something like this seems to satisfy most if not all of those requirements.
>
> local MT = {}
>
> FALSE = setmetatable({-1, "FALSE"}, MT)
> NA = setmetatable({0, "NA"}, MT)
> TRUE = setmetatable({1, "TRUE"}, MT)
>
Actually it should be
FALSE = setmetatable({1, "FALSE"}, MT)
NA = setmetatable({0, "NA"}, MT)
TRUE = setmetatable({-1, "TRUE"}, MT)
In order to map XOR into regular multiplication FALSE is 1 and TRUE is -1.
This is counterintuitive but has been used with great success in DSPs and ASICs.
--Leo--