当前位置:网站首页>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 !!!
边栏推荐
- [atcoder1984] wide swap
- Miscellany C language
- Import on CSDN MD file
- Use of wordcloud
- 【HDU6357】Hills And Valleys(DP)
- Pat class A by category
- Qunhui ds918 creates m.2 SSD read / write cache
- [noip2016 d1t3] changing classrooms (expectation dp+floyd) (trap of extreme thinking!)
- 【AtCoder2305】Decrementing(博弈)
- Classes and objects (medium)
猜你喜欢

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

C# 微信上传Form-data

May 30-June 5, 2022 AI industry weekly (issue 100): three years

RTMP protocol

Zero foundation self-study SQL course | outer join external connection

3年功能测试拿8K,被新来的反超,其实你在假装努力
![[untitled] Weng_ C lesson 1](/img/4e/41876093ef6b6a38909832f89e1495.jpg)
[untitled] Weng_ C lesson 1

【Oracle 数据库】奶妈式教程day03 排序查询
![[Oracle database] mammy tutorial day02 use of database management tool sqlplus](/img/f2/8f6f74a62427ebfb4c805c1e9b3352.png)
[Oracle database] mammy tutorial day02 use of database management tool sqlplus

Nim product
随机推荐
Bidirectional linked list simple template (pointer version)
Flask页面的分页
20200802 T3 I always like [generating function exclusion, Lagrangian inversion]
Use of wordcloud
测试4年裸辞失业,面试15k的测试岗被按在地上摩擦,结局让我崩溃大哭...
Import on CSDN MD file
【AtCoder2387】+/- Rectangle
3年功能测试拿8K,被新来的反超,其实你在假装努力
C language function stack frame
Implementation of queue (C language)
Sort - select sort
【集群】LVS+keepalived高可用集群
【AtCoder2306】Rearranging(拓扑)
Sdl-4 PCM playback
[atcoder1983] BBQ hard (combination number + clever model transformation)
【IoT】项目管理:如何打造更好的跨职能团队?
C language to write a calculator calculation logic
2021-10-24
Arduino_ Esp32 development record
Wc2020 guessing game