当前位置:网站首页>[secsha concept] original reverse supplement
[secsha concept] original reverse supplement
2022-07-26 01:07:00 【Pink ink white Ling】
Catalog
Seckill concept , Programming is so simple ! Click to subscribe !
Positive numbers
A positive number 、 back 、 The complement is the same
negative
Original code
Directly translate numbers into binary in the form of positive and negative numbers
Inverse code
Change the sign bit of the original code , The other bits can be inverted in turn
Complement code
Inverse code +1 You get the complement
For plastic surgery : The form of data in memory is actually complement
In computer system , Integer type value Always use complement to represent and store
Because subtraction can be achieved by adding complements , therefore CPU There is no need to implement a subtracter , Reduced hardware costs
and The complement of the complement is the original code , therefore CPU You only need to implement the complement and adder to realize the addition, subtraction, multiplication and division of integers
Multiplication is adding more times , Division is to subtract several times , When you want to output a negative number, turn the complement in memory into the source code and then output
Subtraction example :
1 - 1 = 1 + (-1)because int The size of the type is 8 Bytes ,1 Bytes 8 A bit , So there is 32 A bit
1 :
1 The source code of is
0000 0000 0000 0000 0000 0000 0000 0001
1 The inverse of is
0000 0000 0000 0000 0000 0000 0000 0001
1 The complement of is
0000 0000 0000 0000 0000 0000 0000 0001
-1:
-1 The source code of is
1000 0000 0000 0000 0000 0000 0000 0001
-1 The inverse of is
1111 1111 1111 1111 1111 1111 1111 1110
-1 The complement of is
1111 1111 1111 1111 1111 1111 1111 1111
Complement addition equals
(1) 0000 0000 0000 0000 0000 0000 0000 0000
In the front brackets 1 Beyond the 4 Bytes 32 A bit , So it was lost , therefore 1 + (-1) As the result of the 0
边栏推荐
- [RTOS training camp] course learning methods and structural knowledge review + linked list knowledge
- [RTOS training camp] course learning methods and C language knowledge (pointer, structure, function pointer, linked list) and student questions
- 1.30 升级bin文件添加后缀及文件长度
- Implementation process of adding loading effect to easycvr page
- Download exclusively | Alibaba cloud maxcompute questions and answers to unlock SaaS mode cloud data warehouse in this electronic manual!
- Game thinking 17: Road finding engine recast and detour learning II: recast navigation grid generation process and limitations
- 【RTOS训练营】任务调度(续)、任务礼让、调度总结、队列和晚课提问
- Using questpdf operation to generate PDF is faster and more efficient!
- matlab 按位 与 或 非
- 【软件开发规范三】【软件版本命名规范】
猜你喜欢

【RTOS训练营】环形缓冲区、AT指令、预习安排和晚课提问

The bumpy road of referencing jar package json-path.jar in jmeter/idea

Microwave oven rectifier diode cl01-12

The application and principle of changing IP software are very wide. Four methods of dynamic IP replacement are used to protect network privacy

1.30 升级bin文件添加后缀及文件长度

ZK-Rollups工作原理

Docker高级篇-Mysql主从复制

Ssd7 | embedded friendly target detection network, product landing
![[laser principle and application -3]: foreign brands of lasers](/img/8a/620544bb52c6b8c4db83f9a14783bb.png)
[laser principle and application -3]: foreign brands of lasers

Talk about "people" in the R & D team
随机推荐
【RTOS训练营】课程学习方法和C语言知识(指针、结构体、函数指针、链表)和学员问题
How to switch IP and move bricks with mobile game simulator
爬虫小操作
ORACLE——iSupplier 门户开票错误
Crawler small operation
Half of the people in the country run in Changsha. Where do half of the people in Changsha run?
The Chinese input (Pinyin input method) component created by lvgl official +100ask enables lvgl to support Chinese input!
Nanjie's embarrassment
How can I become an irreplaceable programmer?
《nlp入门+实战:第四章:使用pytorch手动实现线性回归 》
健身房一年关店8000家,逆势盈利的工作室是怎么开的?
Test the concept of left shift and right shift
《自然语言处理实战入门》深度学习基础 ---- attention 注意力机制 ,Transformer 深度解析与学习材料汇总
[translation paper] analysis of land cover classification using multi wavelength lidar system (2017)
【RTOS训练营】GPIO知识和预习安排 + 晚课提问
加载dll失败
200 yuan a hair dryer, only a week, to achieve 2million?
【RTOS训练营】上节回顾、空闲任务、定时器任务、执行顺序、调度策略和晚课提问
ZK-Rollups工作原理
[laser principle and application -3]: foreign brands of lasers