当前位置:网站首页>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 plant peptone industry research and trend analysis report
- [original] PLSQL index sorting optimization
- 写给 5000 粉丝的一封信!
- Pytorch installs and uses GPU acceleration
- Authentication principle of Ranger plug-in
- The principle and related problems of acid in MySQL
- Simple application example of rhai script engine
- Redis based distributed lock
- The girlfriend said: if you want to understand the three MySQL logs, I will let you heiheihei!
- Join table query select generation
猜你喜欢

20220216 misc buuctf another world WinHex, ASCII conversion flag zip file extraction and repair if you give me three days of brightness zip to rar, Morse code waveform conversion mysterious tornado br

High quality pump SolidWorks model material recommended, not to be missed

Two-stage RO: part 1

2022-2028 global ultra high purity electrolytic iron powder industry research and trend analysis report

P4学习——Basic Tunneling

C language file operation for conquering C language

2022-2028 global weight loss ginger tea industry research and trend analysis report

2022-2028 global capsule shell industry research and trend analysis report

CentOS installation starts redis

2022-2028 global elevator emergency communication system industry research and trend analysis report
随机推荐
Luogu p1168 median
深度学习的历史
Plot size and resolution with R markdown, knitr, pandoc, beamer
How to specify the number of cycles in JSTL- How to loop over something a specified number of times in JSTL?
A proper job is a good job
什么是产品思维
对libco的一点看法
运动与健康
CentOS installation starts redis
Experiment 8 T-SQL, stored procedure
Can SQL execution be written in tidb dashboard
SAP ui5 beginner tutorial 19 - SAP ui5 data types and complex data binding
leetcode 474. Ones and zeroes (medium)
Some views on libco
Pytorch installs and uses GPU acceleration
C # Generate PPK files in Putty format (passthrough support)
Sword finger offer 19 Regular Expression Matching
Length of the longest integrable subarray
Integer to hexadecimal string PTA
2022就要过去一半了,挣钱好难