Yes:
unsigned char CircLeft (unsigned char value)
{
if (value&0x80) return (value<<1) + 1;
else return (value<<1);
}
unsigned char CircRight (unsigned char value)
{
if (value&0x01) return (value>>1) + 0x80;
else return (value>>1);
}
They perform bitwise operations like AND (&), OR (|), XOR (^) and NOT (~).
in C you can manipulate the individual bits of a data item. << leftwise shift >> rightwise shift & bitwise AND | bitwise OR ~ bitwise complement (flips all bits) I can't go intoa tutorial here in how to use these, but google it - i just did and there's tons of info out there.
num1 <<= 1; /* shift left */
Bitwise OR.
logical and: exp1 && exp2 means: exp1==0 ? 0 : exp2==0 ? 0 : 1
There are eight types of operators which are used in C language.These are- 1.Arithmetic operator 2.Assignment operator 3.Relational operator 4.Increment/Decrement operator 5.Bitwise operator 6.Logical operator 7.Conditional operator 8.Additional operator 1.Arithmetic operator:Arithmetic operators are mathmetical operator.These are addition,Subtraction,Multiplication and divison. 2.Assignment operator:Assignment operators are used to store the result of an expression to a variable.
There are three logical operators in C; AND (&), OR (|), and NOT (^). These are the bitwise versions. The combinatorial versions are &&, , and !.
There is no such thing. Logic is bitwise operation, not a data type.
OperatorDescriptionAssociativity()[].->++ -- Parentheses (function call) (see Note 1)Brackets (array subscript)Member selection via object nameMember selection via pointerPostfix increment/decrement (see Note 2) left-to-right++ --+ -! ~(type)*&sizeof Prefix increment/decrementUnary plus/minusLogical negation/bitwise complementCast (change type)DereferenceAddressDetermine size in bytes right-to-left * / % Multiplication/division/modulus left-to-right + - Addition/subtraction left-to-right > Bitwise shift left, Bitwise shift right left-to-right < >= Relational less than/less than or equal toRelational greater than/greater than or equal to left-to-right == != Relational is equal to/is not equal to left-to-right & Bitwise AND left-to-right ^ Bitwise exclusive OR left-to-right | Bitwise inclusive OR left-to-right && Logical AND left-to-right Logical OR left-to-right ?: Ternary conditional right-to-left =+= -=*= /=%= &=^= |== AssignmentAddition/subtraction assignmentMultiplication/division assignmentModulus/bitwise AND assignmentBitwise exclusive/inclusive OR assignmentBitwise shift left/right assignment right-to-left ,Comma (separate expressions) left-to-right
// Note: ^ is the XOR operator a = a ^ b b = b ^ a a = a ^ b
You could just use memcpy(3), using sizeof() to get the object size.
//lets assume a = 10; b = 20; a = a^b; b = a^b; a = a^b;