当前位置:网站首页>Shift operators
Shift operators
2022-07-01 00:58:00 【Sky • Shang】
<< Shift left operator
>> Shift right operator
notes : The operands of the shift operator can only be integers .
Of its operator The object of action is complement
The printed value is calculated according to the original code , So for negative integers , When it becomes a complement to play the shift operation , You have to subtract it first 1, Then the sign bit remains unchanged , The original code of negative numbers obtained by negating other bits by bits calculates the corresponding decimal system according to the original code
Shift left operator :
Shift rules :
Abandon on the left 、 The right to repair 0

Shift right operator :
Shift rules :
First, there are two kinds of right shift operation :
1. Logical shift
Use... On the left 0 fill , On the right side of the discarded
2. Arithmetic shift
The left is filled with the sign bit of the original value , On the right side of the discarded

Warning :
For shift operators , Don't move negative digits , This is not defined by the standard .
for example :
int num = 10;
num>>-1;
It's wrong.
边栏推荐
- 2022-2028 global PTFE lined valve industry research and trend analysis report
- CMU15445 (Fall 2019) 之 Project#1 - Buffer Pool 详解
- 2022-2028 global electric yacht industry research and trend analysis report
- 2022-2028 global single travel industry research and trend analysis report
- Ranger plug-in development (Part 2)
- Implementation of date class
- 初识 Flutter 的绘图组件 — CustomPaint
- 2022-2028 global elevator emergency communication system industry research and trend analysis report
- P4 learning - p4runtime
- C language file operation for conquering C language
猜你喜欢

20220215 CTF misc buuctf the world in the mirror the use of stegsolve tool data extract

第53章 从业务逻辑实现角度整体性理解程序

初识 Flutter 的绘图组件 — CustomPaint

Deployment of mini version message queue based on redis6.0

Oracle-表的创建与管理

Sword finger offer 18 Delete the node of the linked list

2022-2028 global ethylene oxide scrubber industry research and trend analysis report

Oracle-数据完整性

20220216 misc buuctf backdoor killing (d shield scanning) - clues in the packet (Base64 to image)

Redis - understand the master-slave replication mechanism
随机推荐
The programmer's girlfriend gave me a fatigue driving test
优质的水泵 SolidWorks模型素材推荐,不容错过
Docsify building a personal minimalist knowledge warehouse
Join table query select generation
The girlfriend said: if you want to understand the three MySQL logs, I will let you heiheihei!
Get to know the drawing component of flutter - custompaint
Basic data structure of redis
Tibetan poem PTA
HDU 2488 A Knight's Journey(DFS)
ArrayList analysis 1-cycle, capacity expansion, version
Set different background colors for the border and text of the button
Oracle-表的创建与管理
CMU15445 (Fall 2019) 之 Project#1 - Buffer Pool 详解
Redis - understand the master-slave replication mechanism
ArrayList分析1-循环、扩容、版本
What is the fastest way to import data from HDFS to Clickhouse? Spark is imported through JDBC or HDFS
From January 11, 2007 to January 11, 2022, I have been in SAP Chengdu Research Institute for 15 years
2022-2028 global capsule shell industry research and trend analysis report
Redis - sentinel mode
C WinForm program interface optimization example