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.
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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.