当前位置:网站首页>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.
边栏推荐
- Cloud security daily 220630: the IBM data protection platform has found an arbitrary code execution vulnerability, which needs to be upgraded as soon as possible
- 2022-2028 global plant peptone industry research and trend analysis report
- HDU 2488 A Knight's Journey(DFS)
- C WinForm program interface optimization example
- C#生成putty格式的ppk文件(支持passphrase)
- The principle and related problems of acid in MySQL
- JS bubble sort and select sort
- 2022-2028 global 3D printing ASA consumables industry research and trend analysis report
- Implementation of OSD on Hisilicon platform (1)
- 20220215-ctf-misc-buuctf-einstein-binwalk analyze picture-dd command separate zip file -- look for password in picture attribute
猜你喜欢

Oracle临时表详解

Redis - sentinel mode

Wechat official account development (1) introduction to wechat official account

Sword finger offer 18 Delete the node of the linked list

The principle of journal node

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

Host FL Studio fruit music production daw20.9

2022-2028 global 3D printing ASA consumables industry research and trend analysis report

2022-2028 global single travel industry research and trend analysis report
![[original] PLSQL index sorting optimization](/img/91/dcd0262705a19645f1a87d4cf03bc8.jpg)
[original] PLSQL index sorting optimization
随机推荐
Integer to hexadecimal string PTA
Length of the longest integrable subarray
给按钮的边框和文字设置不同的背景色
2022-2028 global rotary transmission system industry research and trend analysis report
High quality pump SolidWorks model material recommended, not to be missed
Luogu p1168 median
20220216 misc buuctf backdoor killing (d shield scanning) - clues in the packet (Base64 to image)
"Experience" my understanding of user growth "new users"
2022-2028 global ultra high purity electrolytic iron sheet industry research and trend analysis report
2022 is half way through. It's hard to make money
$watch will not trigger data change - $watch not firing on data change
Search rotation sort array
Stack frame
【日常记录】——对BigDecimal除法运算时遇到的Bug
2022-2028 global PTFE lined valve industry research and trend analysis report
ArrayList分析1-循环、扩容、版本
Oracle临时表详解
NE555波形发生器手把手教程之NE555内部结构(一)
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
Implementation of date class