当前位置:网站首页>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 .
边栏推荐
- C # learning notes: structure of CS documents
- Baijia forum the founding of the Eastern Han Dynasty
- Hospital network planning and design document based on GLBP protocol + application form + task statement + opening report + interim examination + literature review + PPT + weekly progress + network to
- Mysql to PostgreSQL real-time data synchronization practice sharing
- Base d'apprentissage de la machine: sélection de fonctionnalités avec lasso
- I stepped on a foundation pit today
- PHP database connection succeeded, but data cannot be inserted
- 1day vulnerability pushback skills practice (3)
- Global and Chinese market of box seals 2022-2028: Research Report on technology, participants, trends, market size and share
- Safety tips - seat belt suddenly fails to pull? High speed police remind you how to use safety belts in a standardized way
猜你喜欢

Li Chuang EDA learning notes 13: electrical network for drawing schematic diagram

Rhcsa day 2

Kiss number + close contact problem

Www 2022 | taxoenrich: self supervised taxonomy complemented by Structural Semantics

Setting methods, usage methods and common usage scenarios of environment variables in postman

Redis notes (I) Linux installation process of redis

Lichuang EDA learning notes 14: PCB board canvas settings

ZABBIX API pulls the values of all hosts of a monitoring item and saves them in Excel

Package and download 10 sets of Apple CMS templates / download the source code of Apple CMS video and film website

Command Execution Vulnerability - command execution - vulnerability sites - code injection - vulnerability exploitation - joint execution - bypass (spaces, keyword filtering, variable bypass) - two ex
随机推荐
The difference between MCU serial communication and parallel communication and the understanding of UART
The "message withdrawal" of a push message push, one click traceless message withdrawal makes the operation no longer difficult
[Wu Enda deep learning] beginner learning record 3 (regularization / error reduction)
Dans la recherche de l'intelligence humaine ai, Meta a misé sur l'apprentissage auto - supervisé
Stm32bug [stlink forced update prompt appears in keilmdk, but it cannot be updated]
Latex tips slash \backslash
Unity knapsack system (code to center and exchange items)
PHP database connection succeeded, but data cannot be inserted
Contest3145 - the 37th game of 2021 freshman individual training match_ D: Ranking
7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages
ZABBIX API batch delete a template of the host
In my spare time, I like to write some technical blogs and read some useless books. If you want to read more of my original articles, you can follow my personal wechat official account up technology c
No clue about the data analysis report? After reading this introduction of smartbi, you will understand!
Kiss number + close contact problem
基於.NetCore開發博客項目 StarBlog - (14) 實現主題切換功能
Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi
Johnson–Lindenstrauss Lemma
MySQL query
How to pipe several commands in Go?
PID of sunflower classic