Strip comments and inline ids onto h*

This commit is contained in:
James Gregory 2013-12-30 15:11:04 +11:00
commit 0f5f617adb
362 changed files with 2519 additions and 6694 deletions

View file

@ -10,16 +10,9 @@
<meta name="vspubdate" content="07/01/97" />
<meta name="vscategory" content="Web and Software Development: Game Development,Web and Software Development: Graphics and Multimedia Development" />
<title>Michael Abrash's Graphics Programming Black Book Special Edition: Speeding Up C with Assembly Language</title><!-- HEADER -->
<!-- Empty Reference Subhead -->
<!--ISBN=1576101746//-->
<!--TITLE=Michael Abrash's Graphics Programming Black Book Special Edition//-->
<!--AUTHOR=Michael Abrash//-->
<!--PUBLISHER=The Coriolis Group, Inc.//-->
<title>Michael Abrash's Graphics Programming Black Book Special Edition: Speeding Up C with Assembly Language</title>
<meta name="chapter" content="08" />
<meta name="pages" content="156-160" />
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
</head>
<body>
@ -37,7 +30,7 @@
<p><br /></p>
<p><b>LISTING 8.1 L8-1.C</b></p><!-- CODE //-->
<p><b>LISTING 8.1 L8-1.C</b></p>
<pre>
/* Program to search an array spanning a linked list of variable-
sized blocks, for all entries with a specified ID number,
@ -158,17 +151,16 @@ unsigned int FindIDAverage(unsigned int SearchedForID,
else
return(IDMatchSum / IDMatchCount);
}
</pre><!-- END CODE //-->
</pre>
<p>The main body of Listing 8.1 constructs a linked list of memory blocks of various sizes and stores an array of structures across those blocks, as shown in Figure 8.2. The function <b>FindIDAverage</b> in Listing 8.1 searches through that array for all matches to a specified ID number and returns the average value of all such matches. <b>FindIDAverage</b> contains two nested loops, the outer one repeating once for each linked block and the inner one repeating once for each array element in each block. The inner loop&mdash;the critical one&mdash;is compact, containing only four statements, and should lend itself rather well to compiler optimization.</p>
<p><a id="Fig2"><!-- </A><A HREF="javascript:displayWindow('images/08-02.jpg',413,265 )"> --><img src="images/08-02.jpg" /><br />
<!-- </A>
<BR><A HREF="javascript:displayWindow('images/08-02.jpg',413,265)"> --><b>Figure 8.2</b></a>&nbsp;&nbsp;<i>Linked array storage format (version 1).</i></p>
<p><a id="Fig2"><img src="images/08-02.jpg" /><br />
<b>Figure 8.2</b></a>&nbsp;&nbsp;<i>Linked array storage format (version 1).</i></p>
<p>As it happens, Microsoft C/C<small>++</small> does optimize the inner loop of <b>FindIDAverage</b> nicely. Listing 8.2 shows the code Microsoft C/C<small>++</small> generates for the inner loop, consisting of a mere seven assembly language instructions inside the loop. The compiler is smart enough to convert the loop index variable, which counts up but is used for nothing but counting loops, into a count-down variable so that the <b>LOOP</b> instruction can be used.</p>
<p><b>LISTING 8.2 L8-2.COD</b></p><!-- CODE //-->
<p><b>LISTING 8.2 L8-2.COD</b></p>
<pre>
; Code generated by Microsoft C for inner loop of FindIDAverage.
;|*** for (WorkingBlockCount=0;
@ -199,7 +191,7 @@ $I265:
mov WORD PTR [bp-2],di ;IDMatchSum
mov WORD PTR [bp-4],dx ;IDMatchCount
$FB264:
</pre><!-- END CODE //-->
</pre>
<p><br /></p>
@ -218,10 +210,6 @@ $FB264:
<div align="center">
Graphics Programming Black Book &copy; 2001 Michael Abrash
</div><!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->
<!-- BEGIN SUB FOOTER -->
<!-- END FOOTER -->
</div>
</body>
</html>