# Thread: Logic operators and binary in Vee

Replies: 3 - Pages: 1 - Oct 26, 2011 8:14 AM Last Post By: perezalvarezhi
 Posts: 15 Registered: 10/25/11
Logic operators and binary in Vee
Posted: Oct 25, 2011 12:29 PM
 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!
 Posts: 319 Registered: 08/23/07
Re: Logic operators and binary in Vee
Posted: Oct 25, 2011 1:41 PM   in response to: perezalvarezhi
 Look for Bitwise under Built In Functions. You'll find everything you need there.Good luck...
 Posts: 319 Registered: 08/23/07
Re: Logic operators and binary in Vee
Posted: Oct 25, 2011 1:46 PM   in response to: perezalvarezhi
 One more thing. In VEE, to work in hex use 0x, To use binary then use #b.Like this:0x100 (256)#b100 (4)Also for hex you can use #h. This is not case sensitive so #B and #H work as well.
 Posts: 15 Registered: 10/25/11
Re: Logic operators and binary in Vee
Posted: Oct 26, 2011 8:14 AM   in response to: perezalvarezhi
 Thank you very much for your help, it was really useful !