# How does Solidity/the EVM store a uint vs. an int?

What's the difference, in terms of bit structure, between an int and a uint under the EVM?

For an example, if an int8's value, expressed in binary, was 00010011, what would the uint8 of that be? What would negative 00010011 look like?

Edition (Thanks Tjaden) : when an int is negative it is represented using two's complement system in which we we get for an int: 1111 1111=−1(255 for uint) whereas 0000 0001=1 (1 for uint).

For example:

``````uint256 u=123456789;
``````

is represented by `0x00000000000000000000000000000000000000000000000000000000075bcd15 ( Big Endian)`

and `int v=-123456789;` is represented by `0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffff8a432eb ( Big Endian )`

``````int w=123456789
``````

is represented by :

``````"0x00000000000000000000000000000000000000000000000000000000075bcd15"
``````
• This is not entirely correct. Solidity (and the signed EVM opcodes) expect signed integers to be in two's complement form. You can't just flip the highest bit and make the number negative – Tjaden Hess Jul 19 '17 at 10:24
• Elaborating on @TjadenHess, you could use the signextend opCode to do this for you. – Meshugah - Bank Of Hodlers Jun 4 at 20:29