当前位置:网站首页>Shift Operators
Shift Operators
2022-07-06 08:34:00 【There is no place to find a bug after treading on iron shoes. I】
One 、 Move left :<<
Move the complement of a number to the left , use 0 fill
#include <stdio.h>
int main()
{
char a = 65;
char c = a<<1;
printf("%d", c);
return 0;
}
The result is :-126
Positive numbers :65
The positive number is the same as the inverse complement :01000001
Result after left shift :10000010 // This is the original code after moving , Need to be converted to complement
Inverse code :11111101
Complement code :11111110
result :-126
negative :-65
Original code :11000001
Inverse code :10111110
Complement code :10111111
Move to the left :01111110 // The original code is a positive number , The former is the same as the latter
result :126
Two 、 Move right :>>
Move the complement of the number to the right , For unsigned numbers , use 0 fill , For signed numbers , Fill with sign bits .
#include <stdio.h>
int main()
{
char a = -7;
char c = a>>2;
printf("%d", c);
return 0;
}
The result is -2
negative :-7
Original code :10000111
Inverse code :11111000
Complement code :11111001
The result after moving right :11111110 // This is the original code after moving , Need to be converted to complement
Inverse code :10000001
Complement code :10000010
result :-2
Positive numbers :7
The positive number is the same as the inverse complement :00000111
The result after moving right :00000001 // This is the original code after moving , It's a positive number , The former is the same as the latter
result :1
边栏推荐
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- China polyether amine Market Forecast and investment strategy report (2022 Edition)
- VMware virtualization cluster
- Permutation and combination function
- Fibonacci sequence
- The mysqlbinlog command uses
- 【MySQL】鎖
- Summary of phased use of sonic one-stop open source distributed cluster cloud real machine test platform
- egg. JS getting started navigation: installation, use and learning
- 企微服务商平台收费接口对接教程
猜你喜欢

优秀的软件测试人员,都具备这些能力

IOT -- interpreting the four tier architecture of the Internet of things

JVM 快速入门

Process of obtaining the electronic version of academic qualifications of xuexin.com

Configuring OSPF load sharing for Huawei devices

Circular reference of ES6 module

Hungry for 4 years + Ali for 2 years: some conclusions and Thoughts on the road of research and development
![[secretly kill little partner pytorch20 days -day01- example of structured data modeling process]](/img/ae/4e616882f6d68acdf8e885843e68a3.jpg)
[secretly kill little partner pytorch20 days -day01- example of structured data modeling process]

查看局域网中电脑设备

Online yaml to CSV tool
随机推荐
【刷题】牛客网面试必刷TOP101
[MySQL] log
TCP/IP协议
LDAP application (4) Jenkins access
Beijing invitation media
pcd转ply后在meshlab无法打开,提示 Error details: Unespected eof
Circular reference of ES6 module
FairGuard游戏加固:游戏出海热潮下,游戏安全面临新挑战
JS pure function
torch建立的网络模型使用torchviz显示
Yyds dry goods inventory three JS source code interpretation eventdispatcher
sublime text的编写程序时的Tab和空格缩进问题
2022.02.13 - NC001. Reverse linked list
pytorch训练好的模型在加载和保存过程中的问题
Research Report on Market Research and investment strategy of microcrystalline graphite materials in China (2022 Edition)
PC easy to use essential software (used)
按位逻辑运算符
egg. JS getting started navigation: installation, use and learning
Bottom up - physical layer
Golang force buckle leetcode 1020 Number of enclaves