I suggest you to use x << y.bit_length() instead of x*256 to make your code more flexible
–
Alik16 mins ago
2
@Alik You are right, but only if the original question wants to deal with bits instead of bytes. Please note that for a = 1 the a.bit_length() gives 1.
–
dlask13 mins ago
1
Oh, I didn't think about the question this way. I think OP should clarify what he wants to do.
–
Alik10 mins ago