当前位置:网站首页>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 .
边栏推荐
- What are the conditions for the opening of Tiktok live broadcast preview?
- Baijia forum the founding of the Eastern Han Dynasty
- C language black Technology: Archimedes spiral! Novel, interesting, advanced~
- Code Execution Vulnerability - no alphanumeric rce create_ function()
- Site favorites
- 基於.NetCore開發博客項目 StarBlog - (14) 實現主題切換功能
- Contest3145 - the 37th game of 2021 freshman individual training match_ 1: Origami
- Remote work guide
- [Yugong series] February 2022 attack and defense world advanced question misc-84 (MySQL)
- How to use STR function of C language
猜你喜欢

What are the conditions for the opening of Tiktok live broadcast preview?

The difference between MCU serial communication and parallel communication and the understanding of UART

7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages

Comment la transformation numérique du crédit d'information de la Chine passe - t - elle du ciel au bout des doigts?

Johnson–Lindenstrauss Lemma

Redis transaction

WP collection plug-in free WordPress collection hang up plug-in

Jenkins continuous integration environment construction V (Jenkins common construction triggers)

Zblog collection plug-in does not need authorization to stay away from the cracked version of zblog

Unspeakable Prometheus monitoring practice
随机推荐
Libcblas appears when installing opencv import CV2 so. 3:cannot open shared object file:NO such file or directory
Command Execution Vulnerability - command execution - vulnerability sites - code injection - vulnerability exploitation - joint execution - bypass (spaces, keyword filtering, variable bypass) - two ex
Ai aide à la recherche de plagiat dans le design artistique! L'équipe du professeur Liu Fang a été embauchée par ACM mm, une conférence multimédia de haut niveau.
The difference between MCU serial communication and parallel communication and the understanding of UART
Global and Chinese market of cell scrapers 2022-2028: Research Report on technology, participants, trends, market size and share
Sword finger offer:55 - I. depth of binary tree
Network communication basic kit -- IPv4 socket structure
How to use websocket to realize simple chat function in C #
STM32 key content
[latex] production of complex tables: excel2latex and detail adjustment
This function has none of DETERMINISTIC, NO SQL..... (you *might* want to use the less safe log_bin_t
Global and Chinese market for travel wheelchairs 2022-2028: Research Report on technology, participants, trends, market size and share
C # learning notes: structure of CS documents
Recent learning fragmentation (14)
[untitled] the relationship between the metauniverse and digital collections
[Wu Enda deep learning] beginner learning record 3 (regularization / error reduction)
2022 Guangxi provincial safety officer a certificate examination materials and Guangxi provincial safety officer a certificate simulation test questions
2006 translation
Cache general management class + cache httpcontext Current. Cache and httpruntime Differences between caches
(column 23) typical C language problem: find the minimum common multiple and maximum common divisor of two numbers. (two solutions)