storage - How computer distinguish an integer is signed or unsigned? -


two's complements set make easier computer compute substraction of 2 numbers. how computer distinguish integer signed integer or unsigned integer? it's 0 , 1 in memory.

for exmaple, 1111 1111 in computer memory may represent number 255 can represent -1.

signed , unsigned use same data, different instructions.

the computer stores signed , unsigned integers same data. i.e. 255 , -1 same bits. however, tell compiler type variable has. if signed, compiler uses signed operators manipulating variables (e.g. idiv) , when unsigned, uses instruction (e.g. div). compiler makes program tells cpu how interpret data.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -