当前位置:网站首页>The property of judging odd or even numbers about XOR.
The property of judging odd or even numbers about XOR.
2022-07-04 03:10:00 【Kinght_ one hundred and twenty-three】
XOR can be simply understood as addition without carry , such as 2 The binary of is 10,1 The binary of is 01,1^2 As the result of the 3, Binary for 11.
Then this property can be used to judge whether odd numbers or even numbers .
The specific content
For example, an even number is 6, Its binary is 110;1 The binary of is 001, that 6^1 As the result of the 7, Binary for 111, Do all even numbers have this property ? Yes , Because the last bit of even binary must be 0, and 1 The last bit of binary must be 1, So all even XORs 1 The result is the original number plus 1 Result .
For example, an odd number is 11, Its binary is 1011,1 The binary of is 0001, that 11^1 As the result of the 10, Binary for 1010. Do all odd numbers have this property ? Yes , Because the last bit of odd binary must be 1, and 1 The last bit of binary must be 1, And because XOR operation can be understood as addition without carry , So all odd XORs 1 The result is the original number minus 1 Result .
边栏推荐
- 2006 translation
- 基於.NetCore開發博客項目 StarBlog - (14) 實現主題切換功能
- Libcblas appears when installing opencv import CV2 so. 3:cannot open shared object file:NO such file or directory
- VRRP+BFD
- 查詢效率提昇10倍!3種優化方案,幫你解决MySQL深分頁問題
- 7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages
- Contest3145 - the 37th game of 2021 freshman individual training match_ E: Eat watermelon
- Key knowledge of embedded driver
- Webhook triggers Jenkins for sonar detection
- Database concept and installation
猜你喜欢
WordPress collection WordPress hang up collection plug-in
Dare to climb here, you're not far from prison, reptile reverse actual combat case
Backpropagation formula derivation [Li Hongyi deep learning version]
The first spring of the new year | a full set of property management application templates are presented, and Bi construction is "out of the box"
Li Chuang EDA learning notes 13: electrical network for drawing schematic diagram
What is cloud primordial?
1day vulnerability pushback skills practice (3)
Database concept and installation
WP collection plug-in free WordPress collection hang up plug-in
Explain AI accelerator in detail: why is this the golden age of AI accelerator?
随机推荐
Key knowledge of embedded driver
MySQL workbench use
Unity knapsack system (code to center and exchange items)
Cache general management class + cache httpcontext Current. Cache and httpruntime Differences between caches
Redis notes (I) Linux installation process of redis
Latex tips slash \backslash
Create real-time video chat in unity3d
C learning notes: C foundation - Language & characteristics interpretation
7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages
Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine
Pagoda SSL can't be accessed? 443 port occupied? resolvent
2022 Guangxi provincial safety officer a certificate examination materials and Guangxi provincial safety officer a certificate simulation test questions
A brief talk on professional modeler: the prospect and professional development of 3D game modeling industry in China
Global and Chinese markets of advanced X-ray inspection system (Axi) in PCB 2022-2028: Research Report on technology, participants, trends, market size and share
Love and self-discipline and strive to live a core life
What are the conditions for the opening of Tiktok live broadcast preview?
SQL injection (1) -- determine whether there are SQL injection vulnerabilities
Www 2022 | taxoenrich: self supervised taxonomy complemented by Structural Semantics
STM32 key content
[development team follows] API specification