当前位置:网站首页>C -- bit operation
C -- bit operation
2022-07-24 01:50:00 【Can't learn java】
An operation
1、 Bit operators and bit operations
| Operator | meaning | Operator | meaning |
|---|---|---|---|
| & | Bitwise AND | ~ | Take the opposite |
| | | Press bit or | << | Move left |
| ^ | Bitwise XOR | >> | Move right |
- priority :~–><<、>>–>&、^、|
- Take the opposite (~) skill :
- The positive result is
-( Positive numbers +1) - The negative result is
-( negative +1) - `x=-(x+1)
- The positive result is
- Shift left operator (<<)
- Used to put all bits of a number in binary
Move left a few places - Shift all binary numbers to the left n position ,
Right side mend 0 - The rules : Move left n Multiply by 2n
- Used to put all bits of a number in binary
- Shift right operator (>>)
- It is used to put all the binaries of a number
Move a few bits to the right - Shift all binary numbers to the right n by ,
Discard at the end of the right end - The rules : Move left n Bits divided by 2n
- It is used to put all the binaries of a number
2、 Compound bit operators
type :&=、|=、^=、<<=、>>=
for example :
a&=b Equivalent to a=a&b a>>=2 Equivalent to a=a>>2
3、 Bit operation features
| 0 | 1 | |
|---|---|---|
| Bitwise & | Zero clearing | unchanged |
| Bitwise | | unchanged | Set up 1 |
| Bitwise ^ | unchanged | Flip |
边栏推荐
- Chapter 9.2 program control of MATLAB
- Advantages and disadvantages of XML
- What are the principal guaranteed financial products with an annual interest rate of about 6%?
- Decrypt redis to help the e-commerce seckill system behind the double 11
- [code case] website confession wall & to do list (including complete source code)
- Review of HCIA
- Topological sorting & critical path
- jmeter+influxdb+grafana压测实时监控平台搭建
- Yinshimei Invisalign oral scan referral method (export oral scan data + online consultation)
- Study and use of burpsuite plug-in
猜你喜欢

Study and use of burpsuite plug-in
Just started to use, ask some questions and tutorials or share posts

Install SSL Certificate in Litespeed web server

Arm architecture and programming 3 -- key control LED (based on Baiwen arm architecture and programming tutorial video)

xxl-job使用注意事项

Hardware knowledge 2 -- Protocol class (based on Baiwen hardware operation Daquan video tutorial)

Yinshimei Invisalign oral scan referral method (export oral scan data + online consultation)

Study and use of windows security defect detection tool wesng

Notes - record a dynamic datasource please check the setting of primary problem solving

Hundred million financing events account for more than 30%. Where is the next stop for super automation? -- Manfu Technology
随机推荐
Hcip day 4 notes
C byte array and class mutual conversion
Database security and data integrity
通过Arduino IDE向闪存文件系统上传文件
xxl-job使用注意事项
Chapter 9.2 program control of MATLAB
Cmake Getting Started tutorial
Study and use of windows security defect detection tool wesng
Network type (notes on the third day)
How to finally generate a file from saveastextfile in spark
Hospital generic cabling
jenkins多任務並發構建
MySQL Basics (operators, sorting and paging, multi table queries, functions)
OSPF (sixth day notes)
Jenkins multitâche construction simultanée
Database design
141. Circular linked list
Decrypt redis to help the e-commerce seckill system behind the double 11
Design of hospital wireless network system
Construction and test of hfish honey pot