当前位置:网站首页>Some binary bit operations
Some binary bit operations
2022-07-27 15:26:00 【Abcheche】
“>>” : Move right :
Be careful :Java Medium “>>” yes Count right : Abandon the lowest position , The high bits are filled with sign bits ;
“>>>” yes Logical shift right : Abandon the lowest position , High level 0 fill .
“|”: Or operation , One on both sides is 1 Namely 1, It can be equivalent to adding , Like binary (10|1) Namely (11)
Set of integers set An operation
When an integer set is marked , For example, in retrospect visited Flag array
vstd visit i :vstd | (1 << i)
vstd Leave i :vstd & ~(1 << i)
vstd It doesn't contain i : not vstd & (1 << i)
Combine :A | B
intersection :A & B
The complete :(1 << n) - 1
Complement set :((1 << n) - 1) ^ A
A subset of :(A & B) == B
Judge whether it is 2 The power of :A & (A - 1) == 0
The lowest 1 Turn into 0 :n &= (n - 1)
The lowest 1:A & (-A), The lowest 1 It is generally recorded as lowbit(A) ( Get the lowest bit of a number 1 And later 0, Other bits become 0)( The opposite number of a number is the number added after its bitwise negation 1)
Properties of XOR operation (^):
XOR operation satisfies the exchange law and the combination law ;
The result of XOR operation of any integer and itself is equal to 0, namely x⊕x=0;
Any integer and 00 The result of XOR operation is equal to itself , namely x⊕0=0⊕x=x.
边栏推荐
- 网络设备硬核技术内幕 路由器篇 CISCO ASR9900拆解 (一)
- 基于stm32的数字示波器设计方案
- Sword finger offer cut rope
- Introduction to STM32 learning can controller
- USB interface electromagnetic compatibility (EMC) solution
- Notice of Shenzhen Municipal Bureau of human resources and social security on the issuance of employment related subsidies for people out of poverty
- 微信公众平台开发概述
- 反射
- 网络设备硬核技术内幕 路由器篇 9 CISCO ASR9900拆解 (二)
- 同花顺开户在手机开户安全吗?
猜你喜欢

Unity 鼠标控制第一人称摄像机视角

Design scheme of digital oscilloscope based on stm32

Stm32f103c8t6 drives sh1106 1.3 "IIC OLED display under Arduino frame

Several basic uses of tl431-2.5v voltage reference chip

Huayun data creates a perfect information technology and innovation talent training system to help the high-quality development of information technology and innovation industry

MySQL 面试40连问,面试官你再问下去我可要翻脸了

Digital storage oscilloscope based on FIFO idt7202-12

reflex

ad7606与stm32连接电路介绍

STM32 can communication filter setting problem
随机推荐
Unity mouse controls the first person camera perspective
LeetCode 781. 森林中的兔子 哈希表/数学问题 medium
STM32F10x_ Hardware I2C read / write EEPROM (standard peripheral library version)
Notice of Nanshan District Civil Affairs Bureau on carrying out the grade evaluation of social organizations in Nanshan District in 2022
AssetBundle如何打包
What is tor? What is the use of tor browser update?
网络设备硬核技术内幕 路由器篇 14 从鹿由器到路由器 (中)
Unity最简洁的对象池实现
两阶段提交与三阶段提交
Overview of wechat public platform development
See "sense of security" in uncertainty Volvo asked in 2022
EMC design scheme of CAN bus
The first common node of the two linked lists of "Jianzhi offer"
Deveco studio2.1 operation item error
LeetCode 456. 132模式 单调栈/medium
多表查询_练习1&练习2&练习3
网络设备硬核技术内幕 路由器篇 16 DPDK及其前传(一)
LeetCode 81. 搜索旋转排序数组 II 二分/medium
网络设备硬核技术内幕 路由器篇 19 DPDK(四)
Problem solving in magic tower project