惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
U
Unit 42
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Full Disclosure
月光博客
月光博客
Engineering at Meta
Engineering at Meta
博客园_首页
The Register - Security
The Register - Security
G
Google Developers Blog
The Cloudflare Blog
博客园 - Franky
K
Kaspersky official blog
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
NISL@THU
NISL@THU
AI
AI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Vercel News
Vercel News
T
Tor Project blog
P
Privacy International News Feed
D
Docker
I
Intezer
L
LangChain Blog
P
Proofpoint News Feed
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
博客园 - 聂微东
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
P
Privacy & Cybersecurity Law Blog
V
V2EX
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
The Hacker News
The Hacker News
T
Tenable Blog
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

博客园 - 萧佰刚

Mtk Ft6306 touch 驱动 . 深圳市鑫侑触控技术有限公司 电容式触摸屏|电容式触摸屏厂|手机触摸屏厂|偏光片贴合 Qt Creator 常用快捷键 结构体指针的指针使用(转) System V共享内存资料 "互斥锁用于上锁,条件变量则用于等待" Linux下UDP编程 Linux Socket编程学习 linux管道学习资料 linux进程间通信——消息队列 C实现单链表(转) C语言枚举类型使用简介 指向结构体指针的例子 字符数组 字符指针 sizeof strlen 的区别 Linux进程间共享临界区“信号量”编程 Linux下Socket编程 Linux下常用函数- 信号处理函数(转) linux信号signal常用信号 Linux 守护进程的编程方法(转)
c语言 位操作
萧佰刚 · 2011-05-30 · via 博客园 - 萧佰刚

位运算符C语言提供了六种位运算符:

1:& 按位与(只有对应的两个二进位均为1时,结果位才为1)

例如:9&5可写算式如下: 00001001 (9的二进制补码)&00000101 (5的二进制补码) 00000001 (1的二进制补码)可见9&5=1。

2:| 按位或(只要对应的二个二进位有一个为1时,结果位就为1。)

例如:9|5可写算式如下:00001001|00000101 结果为:00001101 (十进制为13)可见9|5=13

3:^ 按位异或(当两对应的二进位相异时,结果为1)

例如:9^5可写成算式如下:00001001^00000101 结果为:00001100 (十进制为12)

4:~ 取反(其功能是对参与运算的数的各二进位按位求反)

例如~9的运算为: ~(0000000000001001) 结果为:1111111111110110

5:<< 左移(左边的运算数的各二进位全部左移若干位)

例如: a<<4 指把a的各二进位向左移动4位。如a=00000011(十进制3),左移4位后为00110000(十进制48)

6:>> 右移(右边的运算数的各二进位全部右移若干位)

例如:设 a=15,a>>2 表示把000001111右移为00000011(十进制3)