当前位置:网站首页>Notes on relevant knowledge points such as original code / inverse code / complement code, size end, etc
Notes on relevant knowledge points such as original code / inverse code / complement code, size end, etc
2022-06-12 03:54:00 【salll.】
#include<stdio.h>
int main()
{
char a = -1;//char type 8 individual bite position
// Original code 10000000000000001
// Inverse code 11111111111111110
// Complement code 11111111111111111
//
//11111111
//111111111111111111111
//111111111111111111110
//100000000000000000001
//
signed char b = -1;
unsigned char c = -1;
// Original code 10000000000000001
// Inverse code 11111111111111110
// Complement code 11111111111111111
//
//11111111 - c
// The high order of unsigned numbers is directly complemented 0
//000000000000011111111
//
printf("%d %d %d ", a, b, c);
// Print a Have to be reshaped and improved , Top of complement ( Sign bit )
// Printed is a signed number
return 0;
}#include<stdio.h>
int main()
{
int a = -129;
unsigned int b = -129;
printf("%d %d\n", a, b);// Force to print signed numbers
printf("%u %u\n", a, b);// Force to print unsigned numbers
return 0;
}#include<stdio.h>
// The compiler uses arithmetic shift right Missing the left complement sign bit from the right
int main()
{
int b = 5;
// Positive integer Three yards are the same
//00000000000000000000101 Original code
//00000000000000000000101 Inverse code
//00000000000000000000101 Complement code
b = b >> 1;
//00000000000000000000101
//00000000000000000000010 -> 2 = 0*2^0 + 1*2^1
printf("%d\n", b);
b = b << 1;
//00000000000000000000010
//00000000000000000000100 -> 4 = 0*2^0 + 0*2^1 + 1*2^2
printf("%d\n", b);
int c = -5;
// The first number on the left determines the symbol 1 Negative 0 Being positive
//10000000000000000000101 Original code
//11111111111111111111010 Inverse code
//11111111111111111111011 Complement code = Inverse code + 1
c = c >> 1;
//11111111111111111111011 Take the complement to move
//11111111111111111111101 New complement
//11111111111111111111100 New negative code
//10000000000000000000011 -> -3
printf("%d\n", c);
c = c << 1;
//11111111111111111111101
//11111111111111111111010
//11111111111111111111001
//10000000000000000000110
printf("%d\n", c);
int d = 3;
int e = -5;
int f = d & e;// The complement is both 1 Just take it 1, Others are 0
//00000000000000000000000000011 3 Complement
//11111111111111111111111111011 -5 Complement
//00000000000000000000000000011
printf("%d\n", f);
int g = d | e;// The complement is both 0 Just take it 0, Others are 1
//00000000000000000000000000011 3 Complement
//11111111111111111111111111011 -5 Complement
//11111111111111111111111111011 New complement
//11111111111111111111111111010
//10000000000000000000000000101
printf("%d\n", g);
int h = d ^ e;// The same in the complement is 0, Dissimilarity is 1
//00000000000000000000000000011 3 Complement
//11111111111111111111111111011 -5 Complement
//11111111111111111111111111000 New complement
//11111111111111111111111110111
//10000000000000000000000001000
printf("%d\n", h);
//a ^ a = 0
//0 ^ a = a
}
Small endian byte order : Put the low address in the low address
Big endian byte order : Put the high address in the low address


边栏推荐
- C language array
- LINQ group by and select series - LINQ group by and select collection
- Unity脚本出現missing時的解决方法
- 【FPGA+FFT】基于FPGA的FFT频率计设计与实现
- Esp32c3 remote serial port
- Three ways for ORALCE to process column to row conversion and finally generate table style data
- 双目标定学习资料整理
- The road of global evolution of vivo global mall -- multilingual solution
- [mysql][mysql 8.0 compressed package installation method]
- Sequence list and linked list - primary level
猜你喜欢

顺序表与链表---初阶

oralce 处理列转行的三种方式 最后生成表格样式数据
![[Hongmeng] use the timer to play a simple game of robbing red envelopes](/img/27/32b65dc90db7f6ece24ad39ff9b0ef.png)
[Hongmeng] use the timer to play a simple game of robbing red envelopes

Sequence list and linked list ----- advanced

Goodbye to excel and PPT, I found a better visual fool software

【C语言】封装接口(加减乘除)

Convert py file to EXE file

How to have peace of mind? Get a new heart

关于 国产麒麟Qt编译报错“xxx.pri has modification time xxxx s in the futrue“ 的解决方法

E-commerce middle office system architecture
随机推荐
mysql/oracle 以唯一时间为分界,小于等于该时间求和,大于该时间求和
Emperor Wu of Wei knew that he could not correct it, so he stopped offering his words
Mosaïque d'images basée sur la matrice de transformation
【FPGA+FFT】基于FPGA的FFT频率计设计与实现
Functions (arguments, formal parameters, bubbling)
vim命令大全
MySQL create user and authorize
php和js去掉所有空格
[Yugong series] March 2022 asp Net core Middleware - current limiting
Evolution and practice of Unicom real-time computing platform
智能面板WiFi联动技术,ESP32无线芯片模组,物联网WiFi通信应用
Notes relatives à l'application du certificat de l'AC et de la paire de clés
Unity脚本出現missing時的解决方法
R语言plotly可视化:plotly可视化基础二维直方图、自定义设置二维直方图的颜色、二维直方图是二元分布的直方图可视化(Basic 2D Histogram)
Absolute positioning three ways to center the box
CA certificate and key pair application notes
JSP实现银柜台业务绩效考核系统
[data recovery in North Asia] data recovery in which the logical volume of the server is changed and the file system is damaged due to system reinstallation
消息队列概述
1187_ C language implementation of hysteresis processing