Given an immediate number, judging whether it is legal can be divided into three steps: first, write the given immediate number in 32-bit binary form; then see if an 8-bit binary number can be used to include all the parts containing 1, if not, it is illegal; finally, see if this 8-bit binary number can be cyclically right-shifted by an even number of bits to obtain the given immediate number, if not, it is illegal.
0xff=00000000
0x104=00000000
0x101=00000000
0x102=00000000
0xfC000002
0x8000007E=10000000
Summary: First, to determine whether a number conforms to the principle of 8-bit bitmap, first check whether the number of 1s does not exceed 8 after the number is converted into binary. If not, check whether these n 1s (n<=8) can be put into 8 binary bits at the same time. If they can be put in, check whether these eight binary bits can be cyclically right-shifted by even bits to get the value that was initially judged. If so, this value conforms to the principle of 8-bit bitmap, otherwise, it does not conform. Second, it is impossible to represent an arbitrary 32-bit number with a 12-bit code. Only part of the 32-bit number can be obtained by cyclically right-shifting the even bits of the eight-bit binary number. The rest of the 32-bit numbers that cannot be represented can only be obtained through other means. For example, 0xffffff00 can be obtained by bitwise inversion of 0x000000ff.
Previous article:ARM embedded system serial port expansion
Next article:ARM pseudo-instruction explanation
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- What is UWB technology? Several major mobile phone manufacturers are planning to develop this business
- Dinner is coming! Will you come to the EEWorld Shenzhen dinner on the evening of September 8th?
- Temperature Sensing Guide | Understanding the Design Challenges
- [GD32E503 Evaluation] mig29_Step2 Measure the physical characteristics of DAC and ADC
- Pressure sensor power supply application solution
- RISC-V Manual (Chinese, a guide to the open source instruction set)
- Award Ceremony: Watch the live broadcast to learn more about the principle, operation, and waterproof structure design of ST's latest MEMS barometer
- [Project source code] Design and implementation of multi-channel DDS signal generator based on FPGA
- Introduction to RF Front-end Technology
- Causes of voltage drop and measures to achieve the lowest possible voltage drop