Data types supported by the ARM compiler
************************************************************
Data type Length (bits) Alignment
Char 8 1 (byte alignment)
short 16 2 (hundred word alignment)
Int 32 4 (word alignment)
Long 32 4 (word alignment)
Longlong 64 4 (word alignment)
Float 32 4 (word alignment)
Double 64 4 (word alignment)
Long double 64 4 (word alignment)
All pointers 32 4 (word alignment)
Bool(C++ only) 32 4 (word alignment)
1. Integer type
In the ARM system, integer types are stored in 2's complement form. For long long type, in little endian memory mode, its lower 32 bits are stored in the word unit of the lower address, and the upper 32 bits are stored in the word unit of the higher address; in big endian mode, its lower 32 bits are stored in the word unit of the higher address, and the upper 32 bits are stored in the word unit of the lower address. The following rules are followed for integer data operations:
**All operations on signed integers are performed in binary complement.
**Operations on signed integers do not extend the sign.
**Right shift operations on signed integers are arithmetic shifts.
**The number of shift bits specified is an 8-bit unsigned number.
**The number to be shifted is treated as a 32-bit number.
**The result of a logical left shift of more than 31 bits is 0.
**For unsigned numbers and signed positive numbers, the result of a right shift of more than 32 bits is 0; for signed negative numbers, the result of a right shift of more than 32 bits is -1.
**The remainder and divisor of integer division have the same sign.
**When an integer is truncated to a shorter integer type, the correctness of the highest sign bit of the result cannot be guaranteed.
**Type conversion between integer data will not generate an exception interrupt.
**Overflow of integer data will not generate an exception interrupt.
**Integer data divided by 0 will generate an exception interrupt.
2. Floating point numbers
In the ARM system, floating point numbers are stored according to the IEEE standard.
**Numbers of float type are represented by IEEE single precision numbers.
**Double and long double are represented by IEEE double precision numbers.
The following rules are followed for floating point operations:
**Follow the normal IEEE754 rules.
**Floating point operation exception interrupts are prohibited by default.
**When wraparound occurs, the closest data is used to represent it.
3. Pointer type data
The following rules apply to pointers other than data member pointers:
**NULL is defined as 0.
**The address difference between two adjacent storage units is one.
**When data conversion is performed between a pointer to a function and a pointer to data, the compiler will generate a warning message.
**The type size_t is defined as unsigned int.
**The type ptrdiff_t is defined as signed int.
**When two pointer types are subtracted, the result can be obtained according to the following formula.
((int)a-(int)b)/(int)sizeof(type pointed to)
At this time, as long as the object pointed to by the pointer is not packed, its alignment characteristics can meet the requirements of integer divisibility.
Previous article:ARM Basics Series 8
Next article:ARM Basics Series 6
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- 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
- Resolver software decoding solution based on C2000
- MSP430 Learning Summary 3-MSP430 Basic Clock Module
- Introduction and basic concepts of antennas commonly used in daily EMC and RF testing
- How to speed up the IO port flipping speed
- The National Day holiday is over, why are holidays always so short?
- [TI recommended course] #[High Precision Laboratory] Interface: RS-485#
- 【TI recommended course】# TINA-TI training course#
- What is the difference between Tx and INTX in the attached picture?
- Amplifier Circuit
- MCU、DSP、GPU、MPU、CPU、DPU、FPGA、ASIC、SOC、ECU、NPU、TPU、VPU、APU、BPU、...