Data Types

You already got an aperçu of the first point, how the CPU can manipulate a certain data type, in Chapter 2 with the native code version of computeIterativelyFaster(), which used two add instructions to add two 64–bit integers, as shown in Listing 4–1.

Listing 4–1. Adding Two 64–bit Integers

 448:    e0944002         adds    r4, r4, r2  44c:    e0a55003         adc     r5, r5, r3

Because the ARM registers are 32-bit wide, two instructions are needed to add two 64–bit integers; the lowest 32-bit integers are stored in one register (r4), and the highest 32-bit are stored in another register (r5). Adding two 32-bit values would require a single instruction.

Let's now consider the trivial C function, shown in Listing 4–2, which simply ...

Get Pro Android Apps Performance Optimization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.