当前位置:网站首页>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
边栏推荐
- torch建立的网络模型使用torchviz显示
- 从表中名称映射关系修改视频名称
- Wincc7.5 download and installation tutorial (win10 system)
- Cisp-pte practice explanation
- @JsonBackReference和@JsonManagedReference(解决对象中存在双向引用导致的无限递归)
- MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
- 根据csv文件某一列字符串中某个数字排序
- [2022 Guangdong saim] Lagrange interpolation (multivariate function extreme value divide and conquer NTT)
- Zhong Xuegao, who cannot be melted, cannot escape the life cycle of online celebrity products
- 角色动画(Character Animation)的现状与趋势
猜你喜欢
目标检测——Pytorch 利用mobilenet系列(v1,v2,v3)搭建yolov4目标检测平台
Double pointeur en langage C - - modèle classique
深度剖析C语言数据在内存中的存储
PC easy to use essential software (used)
Trying to use is on a network resource that is unavailable
Image, CV2 read the conversion and size resize change of numpy array of pictures
MySQL learning records 12jdbc operation transactions
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
win10系统中的截图,win+prtSc保存位置
704 二分查找
随机推荐
All the ArrayList knowledge you want to know is here
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
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
深度剖析C语言数据在内存中的存储
Configuring OSPF load sharing for Huawei devices
On the inverse order problem of 01 knapsack problem in one-dimensional state
如何进行接口测试测?有哪些注意事项?保姆级解读
Leetcode skimming (5.29) hash table
生成器参数传入参数
2022.02.13 - NC002. sort
[brush questions] top101 must be brushed in the interview of niuke.com
Rviz仿真时遇到机器人瞬间回到世界坐标原点的问题及可能原因
Wincc7.5 download and installation tutorial (win10 system)
VMware 虚拟化集群
Report on Market Research and investment prospects of China's silver powder industry (2022 Edition)
ROS编译 调用第三方动态库(xxx.so)
Pointer advanced --- pointer array, array pointer
hutool优雅解析URL链接并获取参数
[2022 Guangdong saim] Lagrange interpolation (multivariate function extreme value divide and conquer NTT)
目标检测——Pytorch 利用mobilenet系列(v1,v2,v3)搭建yolov4目标检测平台