Products
Intel Press Home
Books for
  SW Programmers
  Computer System Designers
  Network Infrastructure Design
  Strategic Technologies
  IT Practitioners
 
Intel Press
Right Books. Right Time. From the Experts.
The Software Optmization Cookbook Errata & Q&As

Errata

The solution for example 10.2, on page 136-137 is incorrect. When variable a and b are 'A'-'F', the conversion should be:

a = a - 'A' + 10;

b = b - 'A' + 10;

And remember, it only converts uppercase hex values.

The complete function is then:

void TxtToHexFast (BYTE *pHex, char Txt[], int length)

{

      int i, a, b;

      for (i=0; i<length; i++)

      {

            a = (int)Txt[i*2];

            b = (int)Txt[i*2+1];

            if (a >= 'A')

                  a = a-'A'+10;

            else

                  a = a-'0';

            if (b >= 'A')

                  b = b-'A'+10;

            else

                  b = b-'0';

            pHex[i] = (BYTE)((a<<4) + b);

      }

}


The RotateBlend Sample
Q: What should I do if the samples crash?

A: The Release configuration for the RotateBlend project, located on the included CD, uses the /QxW command-line compiler option. This option gives the IntelŪ C++ compiler permission to use the IntelŪ PentiumŪ 4 processor's instruction set, which it happily does. If you are not running on a Pentium 4 processor or newer, this will fail with an "Unhandled exception in RotateBlend.exe: 0XC000001D: Illegal Instruction." You can solve the problem by using the /QaxW command-line option instead. This will generate a default code path for the times that you may not be running on a Pentium 4 processor or you can buy a new computer. For more detailed information, see the section "Optimizing for Specific Processors" in Chapter 3 (page 21).

Back to Top