"0xDEADBEEF" - Signed or Unsigned?

-1

I wanna know whether a hex number "0xDEADBEEF" is a 32-bit signed number or unsigned number. Because a 32-bit singed number ranges from -2,147,483,648 - 2,147,483,647 but it is 3,735,928,559 so anyone know about this?

unsigned
signed
asked on Stack Overflow Oct 23, 2020 by (unknown user) • edited Oct 23, 2020 by chue x

1 Answer

2

Neither. Sign-ed-ness isn't a property of a set of bits. It's an interpretation layer you impose on top of bits, which inform how you read them.

If you're reading this in a context where you expect these bits to encode an unsigned 32 bit integer, then they have a decimal value of 3,735,928,559.

But if you instead read them in a context where you expect thse bits to encode a signed 32 bit ingeger, then they have a decimal value of -559,038,737.

answered on Stack Overflow Oct 23, 2020 by Alexander - Reinstate Monica • edited Oct 23, 2020 by Alexander - Reinstate Monica

User contributions licensed under CC BY-SA 3.0