SPL Basic Expression - Bit Operation (&, |)


1. And (&) operation
  1. You can apply "And" operation as follows.

      
    clear
    
    a1 = 100
    b1 = 30
    c1 = a1 & b1
    print "c1 = " + Util.ByteToHex(c1)
    
    a2 = 0x11
    b2 = 0x10
    c2 = a2 & b2
    print "c2 = " + Util.ByteToHex(c2)
    
    a3 = 0x0101
    b3 = 0x1111
    c3 = a3 & b3
    print "c3 = " + Util.UShortToHex(c3)
    
    c4 = a3 & 0x1010
    print "c4 = " + Util.UShortToHex(c4)
    
      
 


  • Executed result is as follows.




  • 2. Or (|) operation
    1. You can apply "Or" operation as follows.

        
      clear
      
      a1 = 100
      b1 = 30
      c1 = a1 | b1
      print "c1 = " + Util.ByteToHex(c1)
      
      a2 = 0x11
      b2 = 0x10
      c2 = a2 | b2
      print "c2 = " + Util.ByteToHex(c2)
      
      a3 = 0x0101
      b3 = 0x1111
      c3 = a3 | b3
      print "c3 = " + Util.UShortToHex(c3)
      
      c4 = a3 | 0x1010
      print "c4 = " + Util.UShortToHex(c4)
      
        


    2. Executed result is as follows.