Real Time Systems Design And Analysis

Chapter 7.6.2 - Reduction in Strength

7.6.2 Reduction in Strength

Reduction in strength refers to the use of the fastest macroinstruction possible to
accomplish a given calculation. For example, when optimizing for speed many
compilers will replace multiplication of an integer by another integer that is a
power of 2 by a series of shift instructions. Shift instructions are typically faster
than integer multiplication.

In some compilers, character variables are rarely loaded in registers, whereas
integer variables are. This may be because it is assumed that calculations involving
the integers will take place, whereas those involving characters are unlikely.
Care should therefore be taken in deciding whether a variable should be a character
or an integer.

Furthermore, it is well known that divide instructions typically take longer to
execute than multiply instructions. Hence, it may be better to multiply by the
reciprocal of a number than to divide by that number. For example, x*0.5 will
be faster than x/2.0. Many compilers will not do this automatically.

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: PCMCIA Memory Cards
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.