2 Replies Latest reply on Jan 7, 2014 2:07 PM by marco.zoccoli

    Doubt about an exdesc

    marco.zoccoli
      hello to everyone I have a doubt that I wanted to clarify about a exdesc that I found on a tag:
      Event = sourcetag, IF Not BadVal ('sourcetag') THEN (IF ('sourcetag' AND 1080) = 1024 THEN 1 ELSE (IF ('sourcetag' AND 1080) = 0 THEN 0 ELSE (IF ('sourcetag' AND 1080) 2 = 64 THEN ELSE "Bad Input"))) ELSE "Bad Input"
      and in particular on the parties: IF ('sourcetag' AND 1080) = 1024 IF ('sourcetag' AND 1080) = 64 IF ('sourcetag' AND 1080) = 0
      I wondered the meaning of the "AND 1080" and accordingly, the meaning of the number after the "=" sign
      Thank you all for the availability, greetings
        • Re: Doubt about an exdesc

          Hello Marco,

           

          ('sourcetag' AND 1080) means that a bitmask (identified by 1080) is used with a logical AND against the sourcetag's current value.
          Assuming 16 byte resolution (INT16) the bitwise / dual representation of 1080 would be 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0. Please see the following tables for a few examples.

           

           

          dual decimal
          bitmask 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 1080
          sourcetag 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1024
          result 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1024
          dual decimal
          bitmask 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 1080
          sourcetag 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 64
          result 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
          dual decimal
          bitmask 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 1080
          sourcetag 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 100
          result 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 32

           

           

          I hope that I didn't make any mistake when dealing with 1's and 0's. CPU's do this a lot better than human brains.

           

          One interesting thing is the result will never be 64 because with 1080 the bit representing 64 is not set. Also 2 will never become equal to 64. Did you possibly break the equation when pasting it?