当前位置:网站首页>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
边栏推荐
- [brush questions] top101 must be brushed in the interview of niuke.com
- Image,cv2读取图片的numpy数组的转换和尺寸resize变化
- 指针进阶---指针数组,数组指针
- 深度剖析C语言指针
- C language custom type: struct
- 2022 Inner Mongolia latest water conservancy and hydropower construction safety officer simulation examination questions and answers
- [MySQL] database stored procedure and storage function clearance tutorial (full version)
- Chrome浏览器的crash问题
- On the inverse order problem of 01 knapsack problem in one-dimensional state
- JS inheritance method
猜你喜欢

marathon-envs项目环境配置(强化学习模仿参考动作)

On the day of resignation, jd.com deleted the database and ran away, and the programmer was sentenced

Screenshot in win10 system, win+prtsc save location

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

Pointer advanced --- pointer array, array pointer

TCP/IP协议

目标检测——Pytorch 利用mobilenet系列(v1,v2,v3)搭建yolov4目标检测平台
![[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes](/img/ac/773ce8ee7f380df19edf8373250608.jpg)
[cloud native topic -45]:kubesphere cloud Governance - Introduction and overall architecture of enterprise container platform based on kubernetes

Visual implementation and inspection of visdom

Yyds dry goods inventory three JS source code interpretation eventdispatcher
随机推荐
Verrouillage [MySQL]
深度剖析C语言指针
查看局域网中电脑设备
C语言双指针——经典题型
Report on Market Research and investment prospects of China's silver powder industry (2022 Edition)
@JsonBackReference和@JsonManagedReference(解决对象中存在双向引用导致的无限递归)
synchronized 解决共享带来的问题
LDAP application (4) Jenkins access
【MySQL】日志
Research and investment forecast report of citronellol industry in China (2022 Edition)
LDAP应用篇(4)Jenkins接入
hutool优雅解析URL链接并获取参数
On the day of resignation, jd.com deleted the database and ran away, and the programmer was sentenced
egg. JS project deployment online server
Mobile phones and computers on the same LAN access each other, IIS settings
Yyds dry goods inventory three JS source code interpretation eventdispatcher
visdom可视化实现与检查介绍
JS inheritance method
tree树的精准查询
Research Report on supply and demand and development prospects of China's high purity aluminum market (2022 Edition)