Replies: 4 comments
-
|
My theory is that 0b10000000 is interpreted as a signed integer and the most significant bit is sign extended. The U makes it unsigned. |
Beta Was this translation helpful? Give feedback.
-
|
Yes, perhaps you are right, although it may not seem obvious. |
Beta Was this translation helpful? Give feedback.
-
|
That tallies with Here prefix 0 refers to the zero following the However it is not strictly true I think that something more subtle is happening, it is not arbitrary width binary values, it seems that it is being interpreted as 8 bit, 16 bit and 32 bit to determine if the sign should be extended or not. It is only counted as a leading sign bit if it is 2 to the power of 7, 15, 31 or 63. It falls over with 64 bit binary with an additional leading zero Test script Results
|
Beta Was this translation helpful? Give feedback.
-
That's what I meant. The |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
PS.
s/equalent/equivalentBeta Was this translation helpful? Give feedback.
All reactions