What is the best way to construct a bit mask in C with m set bits preceded by k unset bits, and followed by n unset bits:
00..0 11..1 00..0 k m n
For example, k=1, m=4, n=3 would result in the bit mask:
01111000
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.
You can do: