Operators |= &= ~ in C language

Solved
cyrard -  
 ikoria -
Hello,

I am doing reverse engineering of the OpenSSL CMS sources and since I am not very experienced in C, I do not understand the following operators:
|=
&=
~
in the following context:

int flags=CMS_DETACHED;
[...]
flags &= ~CMS_DETACHED;
[...]
flags |= CMS_BINARY;


In C language tutorials online, these operators are not discussed.
Could they be defined in the command lines of the preprocessor in some .h file of the application?

Thank you
Configuration: Linux Kubuntu 7.04 gutsy Kdevelop

7 réponses

Anonymous user
 
a |= b; is equivalent to: a = a|b; => the binary "or"
Example with a = 10 (00001010 in binary) and b = 6 (00000110 in binary)
after a|=b, a will contain 14 (00001110 in binary)

a&=b is equivalent to a=a&b; => the binary "and"
to resume my example: after a&=b; a will contain 2 (00000010 in binary)

the tilde ~ is, if I remember correctly, the complement.
29