Combinator magic help ?
Posted: Mon Aug 03, 2020 8:45 am
Hello everyone! Going back to the game after a long pause, and I have a bit of an issue regarding some combinator magic. Not sure if this is something I dont understand or a bug ?
I use arithmetic combinators to transfer 32 1-bit messages on one combinator signal.
This is a simplified yet functional model of what I am trying to accomplish :
A "0 or 1" signal is left-shifted by a certain value, then mixed up with the rest and decoded by right-shifting the total.
However, it does work only when the 32nd bit is not active. I know this is the sign bit, but I would expect it to be right-shifted nevertheless. Instead, when I use the operation 1 << 31, every signal that I decode is negative. I mean, right shifting the sign bit should put a 0 in its place and transform the value back to a positive integer, right ? Or am I missing something ? I have a work around for that (detect values != 0 instead of > 0) but I dont understand why it behaves this way ?
Thank you for your help
I use arithmetic combinators to transfer 32 1-bit messages on one combinator signal.
This is a simplified yet functional model of what I am trying to accomplish :
A "0 or 1" signal is left-shifted by a certain value, then mixed up with the rest and decoded by right-shifting the total.
However, it does work only when the 32nd bit is not active. I know this is the sign bit, but I would expect it to be right-shifted nevertheless. Instead, when I use the operation 1 << 31, every signal that I decode is negative. I mean, right shifting the sign bit should put a 0 in its place and transform the value back to a positive integer, right ? Or am I missing something ? I have a work around for that (detect values != 0 instead of > 0) but I dont understand why it behaves this way ?
Thank you for your help