Start a new topic

* They are coming: & | << >>

Well, there will soon be fewer bytes available for future features

    but for those that wanted these ... your day to celebrate is near.


In code, the main reason to use these are for processing speed

    as these usually are operated on processor registers

In line by line interpreted the speed will most certainly not be there.


But for those who prefer to obfuscate their code should someone peer

     over your shoulder .. obfuscate, and then obfuscate some more !


4 people like this idea

Logical bitwise operator &

   n0.val=va0.val&32

    1 1 1 1.1 1 1 1.1 1 1 1.1 1 1 1 

    0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0

    0 0 0 0.0 0 0 0.0 0 1 0.0 0 0 0

n0.val bits will only be 1 if mask bit is 1


Logical bitwise operator |

    n0.val=va0.val|32

    0 0 0 0.1 0 0 1.1 0 0 1.0 0 1 1

    0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0

    0 0 0 0.1 0 0 1.1 0 1 1.0 0 1 1

n0.val bits will be 1 if either bit is 1


Logical left shift   <<

    n0.val=va0.val<<4

    0 0 0 0.0 0 1 1.1 1 0 0.0 0 0 1

    0 0 1 1.1 1 0 0.0 0 0 1.       

    0 0 1 1.1 1 0 0.0 0 0 1.0 0 0 0

n0.val bits are shifted to the right

    the 4 left most bits are lost

    the 4 right most spaces filled with zeros


Logical left shift   >>

    n0.val=va0.val>>4

    0 0 0 0.0 0 1 1.1 1 0 0.0 0 0 1

                0 0 0 0.0 0 1 1.1 1 0 0

    0 0 0 0.0 0 0 0.0 0 1 1.1 1 0 0

n0.val bits are shifted to the left

    the 4 right most bits are lost

    the 4 left most spaces filled with zeros


2 people like this

Logical bitwise operator &   

n0.val=va0.val & 32


Is there intentionally a space before and after "&",

or should it be "n0.val=va0.val&32" without spaces?

In the spirit of Nextion, spaces

   separate commands and parameters unless within quotes


But as for typos ... mwahahahaha.  mwahahahaha.

Login or Signup to post a comment