Specifically, could you tell me what this line of code does:
int var1 = (var2 + 7) & ~7;
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s bitwise negation. This means that it performs the binary NOT operator on every bit of a number. For example:
When coupled with the & operator it is used for clearing bits. So, in your example it means that the last 3 bits of the result of
var2+7are set to zeroes.As noted in the comments, it’s also used to denote destructors, but that’s not the case in your example.