当前位置:网站首页>Three expressions of integers and their storage in memory
Three expressions of integers and their storage in memory
2022-06-11 07:43:00 【Fried tomatoes 110】
Integers are stored in memory as complements
Integers have 3 A binary representation : Original code 、 Inverse and complement . Integers are stored in memory Complement code . Next, let me talk about the original code 、 What are the forms of inverse code and complement code .
For positive numbers , Its original code 、 The inverse and complement are the same .
integer , stay 32 It's a bit of a platform 4 Bytes ,32 A bit
Positive integer 5, Its original code 、 Inverse code 、 The complement is the same , as follows :
Original code :0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
Inverse code :0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
Complement code :0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
And negative integers 5, Its original code 、 Inverse code 、 The complement is exactly like this :
Original code :1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
Inverse code :1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0
Complement code :1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1
Integer when stored , The highest bit is the sign bit ,0 It means a positive number ,1 A negative number . therefore 5 The highest bit of the original code of is 0,-5 The highest bit of the original code of is 1. and The inverse of a negative number It is based on the original code , The highest bit, that is, the sign bit remains unchanged , Other bits are reversed ; Complement is to add... To the inverse binary 1. Last but not least , Integers are stored in memory as complements !!!
边栏推荐
猜你喜欢

Zero foundation self-study SQL course | union joint query

You got 8K in the 3-year function test, but you were actually pretending to work hard

C language - Growth Diary -01- count primes and sum

Use of wordcloud

Qstring to hexadecimal qstring

C- print 99 multiplication table

Qunhui ds918 creates m.2 SSD read / write cache

C language function stack frame

How to prepare for the new PMP syllabus exam?

Zero foundation self-study SQL course | outer join external connection
随机推荐
.NET C#基础(6):命名空间 - 有名字的作用域
Sdl-2 thread logic
放大镜子效果图
multi-sig SC
Black Qunhui dsm7.0.1 physical machine installation tutorial
Paging of the flask page
[atcoder1984] wide swap
pmp到底是什么?
TiDB Cloud 上线 Google Cloud Marketplace,以全新一栈式实时 HTAP 数据库赋能全球开发者
Sdl-4 PCM playback
C language - Growth Diary -03- function definition and function prototype declaration
C language function stack frame
【Oracle 数据库】奶妈式教程day03 排序查询
Use of wordcloud
MFC debugger OutputDebugString override
Summary of written test questions of shopee 2021 autumn recruitment
[atcoder2307] tree game
QObject usage skills -- control function class
The solution of "no startup device" after running Bochs
C language volatile