AnsweredAssumed Answered

Logic operators and binary in Vee

Question asked by perezalvarezhi on Oct 25, 2011
Latest reply on Oct 26, 2011 by perezalvarezhi
Does anybody know how can I make logic operations in Vee?  I want to be able to do bitwise and, or, xor and bitwise shifting. The equivalent in C++ would be the &(and), |(or), ^(xor), >> right shift, << left shift,
Im posting an example of the kind of C++ code I want to migrate so that I can explain myself.

Also as a separate issue, I need to work at bit level, is there anything in Vee that allows me to work in binary like C++ 0b0001(one in binary) or 0x0A(10 in hex)

void checkSum( BYTE cheSuIn ){
     DWORD mask = 0x01;
     DWORD aux  = 0;
     DWORD aux2 = 0;
     DWORD aux3 = 0;
     for ( DWORD i = 0; i<8 ; i++   ){
          aux = ( (cheSuIn & mask) >> i ) ;
          aux2 = ((cheSuOut & 0x8000)>>15); 
     /*---[ Xor 1 ]-------------*/
          aux = aux ^ aux2;                                                                                     
     /*---[ Xor 2 ]-------------*/
          aux2 = (( ( (cheSuOut & 0x0010)>>4 ) ^ aux));                                             
     /*---[ Xor 3 ]-------------*/
          aux3 = (( ( (cheSuOut & 0x0800)>>11 ) ^ aux));                                        
     /*---[ Shift ]-------------*/
          cheSuOut = (cheSuOut << 1);
     /*---[ Inyection]-------------*/
          cheSuOut = cheSuOut + aux;
          if ( aux2 == 1 ){
               cheSuOut= cheSuOut | 0x0020;
          }else{
               cheSuOut= cheSuOut & 0xFFDF;
          }
          if ( aux3 == 1 ){
               cheSuOut= cheSuOut | 0x1000;
          }else{
               cheSuOut= cheSuOut & 0xEFFF;
          }
          mask= (mask<<1);
     }
}


Thank you!  

Outcomes