I would like to perform this calculation wihout the bitwise operator.
unsigned result = (1u << 5);
The result will be 32. I know that’s converting the binary 1 to 100000 but I would like to perform the same thing without bitwise operations.
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.
Since you know that 25 is 32, you could just use:
Otherwise, if you just want to use the bitshift value, there are two ways. The first is a loop:
or a non-loop version: