Do signed and unsigned integers take up same amount of memory?
For example, there is fixed size of memory for them, the only difference is one starts from 0 to X and other from -x/2 to x/2 (ofc x/2 is approximation for the sake of example, dont bully for notations)?
Yes.
>>58354398
Yes, an n-bit signed integer and an n-bit unsigned integer both require at least n bits of memory
Yes but they have different ranges. Int could be -2^31 to +2^31 - 1but unsigned could be from 0 to 2^32 - 1
>>58354918
>>58354931
Thanks anons
>>58354398
they don't "take up the same amount of memory", they literally are the exactly same memory where the first/highest bit is just interpreted differently.
adding two integers as signed vs. unsigned is identical except in how wrap-around flags are set. register/memory values are really only (un)signed at the moments when (un)signed operations are applied, and are just ambiguous bit vectors the rest of the time.
>>58355353
nice