I have seen this in a java code.
int n = 300 //passed through a function
size = (n + 31) >> 5 //size = 10
what could be the significance of 5?
What is the significance of 31 //should something to do with int size (31 bit + 1 sign)
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.
The significance of 5 is that 32 = 2^5.
sets
sizetoceiling(n/32), which is the number of 32-bit integers needed to storenbit flags.The addition of 31 to
nis to make sure that the dividend is at least as large as the smallest multiple of 32 greater than or equal ton.