Hi guys,
Previously Jonny has suggested avoiding using too many Logical Operators as they could potentially cause lots of branches and unpredictable behavior during compiling.
What is a good practice method of returning 1, when both source variables are 0?
Although the variables will be whole bytes, only the first bit is ever used...so can I get away with bitwise?
Output = Input1 NOR Input2 ??
Output = Not ( Input1 OR input2)
thanks, J.
Logical NOR - how to achieve, best practice
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Logical NOR - how to achieve, best practice
Hello,
What about this?
(!(input1 | input2)) & 0x01
What about this?
(!(input1 | input2)) & 0x01
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Logical NOR - how to achieve, best practice
Thanks Ben,
I'll use that for now, I thought Logical operators were best avoided or is that not always the case? As i see your example uses 3 different types.
J.
I'll use that for now, I thought Logical operators were best avoided or is that not always the case? As i see your example uses 3 different types.

J.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Logical NOR - how to achieve, best practice
Hello,
Jonny may know bettet but I think as long as it is bracketed correctly then it shouldn't be an issue.
This should also work.
(~(input1 | input2)) & 0x01
Jonny may know bettet but I think as long as it is bracketed correctly then it shouldn't be an issue.
This should also work.
(~(input1 | input2)) & 0x01
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Logical NOR - how to achieve, best practice
Thanks for the clarification Ben.
Good stuff.
Coming from a non-cody back ground, its always tricky working out whats ugly but works VS a neat little program!
Good stuff.

Coming from a non-cody back ground, its always tricky working out whats ugly but works VS a neat little program!