Retidy, removing align=left from headings and empty paragraphs

This commit is contained in:
James Gregory 2013-12-30 15:37:13 +11:00
commit a96a114403
362 changed files with 8472 additions and 5040 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="02-03.html">Previous</a></td> <td>
<a href="02-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="03-02.html">Next</a></td> <td>
<a href="03-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<h2 id="Heading1">Chapter 3<br /> <h2 id="Heading1">Chapter 3<br />
Assume Nothing</h2> Assume Nothing</h2>
@ -69,16 +72,20 @@
<p>Listing 3.1 shows 8253-based timer software, consisting of three subroutines: <b>ZTimerOn, ZTimerOff</b>, and <b>ZTimerReport</b>. For the remainder of this book, I&rsquo;ll refer to these routines collectively as the &ldquo;Zen timer.&rdquo; C-callable versions of the two precision Zen timers are presented in Chapter K on the companion CD-ROM.</p> <p>Listing 3.1 shows 8253-based timer software, consisting of three subroutines: <b>ZTimerOn, ZTimerOff</b>, and <b>ZTimerReport</b>. For the remainder of this book, I&rsquo;ll refer to these routines collectively as the &ldquo;Zen timer.&rdquo; C-callable versions of the two precision Zen timers are presented in Chapter K on the companion CD-ROM.</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="02-03.html">Previous</a></td> <td>
<a href="02-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="03-02.html">Next</a></td> <td>
<a href="03-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="03-01.html">Previous</a></td> <td>
<a href="03-01.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="03-03.html">Next</a></td> <td>
<a href="03-03.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 3.1 PZTIMER.ASM</b></p> <p><b>LISTING 3.1 PZTIMER.ASM</b></p>
<pre> <pre>
; The precision Zen timer (PZTIMER.ASM) ; The precision Zen timer (PZTIMER.ASM)
@ -473,16 +476,20 @@ Code ends
end end
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="03-01.html">Previous</a></td> <td>
<a href="03-01.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="03-03.html">Next</a></td> <td>
<a href="03-03.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="03-08.html">Previous</a></td> <td>
<a href="03-08.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="03-10.html">Next</a></td> <td>
<a href="03-10.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 3.7 LZTIME.BAT</b></p> <p><b>LISTING 3.7 LZTIME.BAT</b></p>
<pre> <pre>
echo off echo off
@ -146,16 +149,20 @@ lztime lst3-8.asm
extern &ldquo;C&rdquo; ZTimerOn(void); extern &ldquo;C&rdquo; ZTimerOn(void);
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="03-08.html">Previous</a></td> <td>
<a href="03-08.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="03-10.html">Next</a></td> <td>
<a href="03-10.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="04-10.html">Previous</a></td> <td>
<a href="04-10.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="05-02.html">Next</a></td> <td>
<a href="05-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<h2 id="Heading1">Chapter 5<br /> <h2 id="Heading1">Chapter 5<br />
Crossing the Border</h2> Crossing the Border</h2>
@ -59,7 +62,7 @@
<p>And with that, let&rsquo;s look at a fairly complex application of restartable blocks.</p> <p>And with that, let&rsquo;s look at a fairly complex application of restartable blocks.</p>
<h4 align="left" id="Heading3">Searching for Text</h4> <h4 id="Heading3">Searching for Text</h4>
<p>The application we&rsquo;re going to examine searches a file for a specified string. We&rsquo;ll develop a program that will search the file specified on the command line for a string (also specified on the comline), then report whether the string was found or not. (Because the searched-for string is obtained via <b>argv</b>, it can&rsquo;t contain any whitespace characters.)</p> <p>The application we&rsquo;re going to examine searches a file for a specified string. We&rsquo;ll develop a program that will search the file specified on the command line for a string (also specified on the comline), then report whether the string was found or not. (Because the searched-for string is obtained via <b>argv</b>, it can&rsquo;t contain any whitespace characters.)</p>
@ -75,16 +78,20 @@
<p>The easiest approach would be to use a C/C<small>++</small> library function. The closest match to what we need is <b>strstr()</b>, which searches one string for the first occurrence of a second string. However, while <b>strstr()</b> would work, it isn&rsquo;t ideal for our purposes. The problem is this: Where we want to search a fixed-length buffer for the first occurrence of a string, <b>strstr()</b> searches a <i>string</i> for the first occurrence of another string.</p> <p>The easiest approach would be to use a C/C<small>++</small> library function. The closest match to what we need is <b>strstr()</b>, which searches one string for the first occurrence of a second string. However, while <b>strstr()</b> would work, it isn&rsquo;t ideal for our purposes. The problem is this: Where we want to search a fixed-length buffer for the first occurrence of a string, <b>strstr()</b> searches a <i>string</i> for the first occurrence of another string.</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="04-10.html">Previous</a></td> <td>
<a href="04-10.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="05-02.html">Next</a></td> <td>
<a href="05-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="05-01.html">Previous</a></td> <td>
<a href="05-01.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="05-03.html">Next</a></td> <td>
<a href="05-03.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p>We could put a zero byte at the end of our buffer to allow <b>strstr()</b> to work, but why bother? The <b>strstr()</b> function must spend time either checking for the end of the string being searched or determining the length of that string&mdash;wasted effort given that we already know exactly how long our search buffer is. Even if a given <b>strstr()</b> implementation is well-written, its performance will suffer, at least for our application, from unnecessary overhead.</p> <p>We could put a zero byte at the end of our buffer to allow <b>strstr()</b> to work, but why bother? The <b>strstr()</b> function must spend time either checking for the end of the string being searched or determining the length of that string&mdash;wasted effort given that we already know exactly how long our search buffer is. Even if a given <b>strstr()</b> implementation is well-written, its performance will suffer, at least for our application, from unnecessary overhead.</p>
<table width="100%"> <table width="100%">
@ -64,7 +67,7 @@
<p>Now that we&rsquo;ve selected a searching approach, let&rsquo;s integrate it with file handling and searching through multiple blocks. In other words, let&rsquo;s make it restartable.</p> <p>Now that we&rsquo;ve selected a searching approach, let&rsquo;s integrate it with file handling and searching through multiple blocks. In other words, let&rsquo;s make it restartable.</p>
<h4 align="left" id="Heading7">Making a Search Restartable</h4> <h4 id="Heading7">Making a Search Restartable</h4>
<p>As it happens, there&rsquo;s no great trick to putting the pieces of this search program together. Basically, we&rsquo;ll read in a buffer of data (we&rsquo;ll work with 16K at a time to avoid signed overflow problems with integers), search it for a match with the <b>memchr()/memcmp()</b> engine described, and exit with a &ldquo;string found&rdquo; response if the desired string is found.</p> <p>As it happens, there&rsquo;s no great trick to putting the pieces of this search program together. Basically, we&rsquo;ll read in a buffer of data (we&rsquo;ll work with 16K at a time to avoid signed overflow problems with integers), search it for a match with the <b>memchr()/memcmp()</b> engine described, and exit with a &ldquo;string found&rdquo; response if the desired string is found.</p>
@ -76,16 +79,20 @@
<p>Listing 5.1 nicely illustrates the core concept of restartable blocks: Organize your program so that you can do your processing within each block as fast as you could if there were only one block&mdash;which is to say at top speed&mdash;and make your blocks as large as possible in order to minimize the overhead associated with going from one block to the next.</p> <p>Listing 5.1 nicely illustrates the core concept of restartable blocks: Organize your program so that you can do your processing within each block as fast as you could if there were only one block&mdash;which is to say at top speed&mdash;and make your blocks as large as possible in order to minimize the overhead associated with going from one block to the next.</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="05-01.html">Previous</a></td> <td>
<a href="05-01.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="05-03.html">Next</a></td> <td>
<a href="05-03.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="05-02.html">Previous</a></td> <td>
<a href="05-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="05-04.html">Next</a></td> <td>
<a href="05-04.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 5.1 SEARCH.C</b></p> <p><b>LISTING 5.1 SEARCH.C</b></p>
<pre> <pre>
/* Program to search the file specified by the first command-line /* Program to search the file specified by the first command-line
@ -199,16 +202,20 @@ main(int argc, char *argv[]) {
} }
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="05-02.html">Previous</a></td> <td>
<a href="05-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="05-04.html">Next</a></td> <td>
<a href="05-04.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="05-04.html">Previous</a></td> <td>
<a href="05-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="06-01.html">Next</a></td> <td>
<a href="06-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p>It might also be worth converting the search engine to assembly for searches performed entirely in memory; with the overhead of file access eliminated, improvements in search-engine performance would translate directly into significantly faster overall performance. One such application that would have much the same structure as Listing 5.1 would be searching through expanded memory buffers, and another would be searching through huge (segment-spanning) buffers.</p> <p>It might also be worth converting the search engine to assembly for searches performed entirely in memory; with the overhead of file access eliminated, improvements in search-engine performance would translate directly into significantly faster overall performance. One such application that would have much the same structure as Listing 5.1 would be searching through expanded memory buffers, and another would be searching through huge (segment-spanning) buffers.</p>
<p>And so we find, as we so often will, that optimization is definitely not a cut-and-dried matter, and that there is no such thing as a single &ldquo;best&rdquo; approach.</p> <p>And so we find, as we so often will, that optimization is definitely not a cut-and-dried matter, and that there is no such thing as a single &ldquo;best&rdquo; approach.</p>
@ -66,16 +69,20 @@
<p>Would you?</p> <p>Would you?</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="05-04.html">Previous</a></td> <td>
<a href="05-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="06-01.html">Next</a></td> <td>
<a href="06-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="05-05.html">Previous</a></td> <td>
<a href="05-05.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="06-02.html">Next</a></td> <td>
<a href="06-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<h2 id="Heading1">Chapter 6<br /> <h2 id="Heading1">Chapter 6<br />
Looking Past Face Value</h2> Looking Past Face Value</h2>
@ -59,7 +62,7 @@
<p>In short, the x86 family can do much more than you think&mdash;if you&rsquo;ll use everything it has to offer. Give it a shot!</p> <p>In short, the x86 family can do much more than you think&mdash;if you&rsquo;ll use everything it has to offer. Give it a shot!</p>
<h4 align="left" id="Heading3">Memory Addressing and Arithmetic</h4> <h4 id="Heading3">Memory Addressing and Arithmetic</h4>
<p>Years ago, I saw a clip on the David Letterman show in which Letterman walked into a store by the name of &ldquo;Just Lamps&rdquo; and asked, &ldquo;So what do you sell here?&rdquo;</p> <p>Years ago, I saw a clip on the David Letterman show in which Letterman walked into a store by the name of &ldquo;Just Lamps&rdquo; and asked, &ldquo;So what do you sell here?&rdquo;</p>
@ -86,16 +89,20 @@ mov al,[bx]
mov al,[bx+si] mov al,[bx+si]
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="05-05.html">Previous</a></td> <td>
<a href="05-05.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="06-02.html">Next</a></td> <td>
<a href="06-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="07-03.html">Previous</a></td> <td>
<a href="07-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="07-05.html">Next</a></td> <td>
<a href="07-05.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 7.2 L7-2.ASM</b></p> <p><b>LISTING 7.2 L7-2.ASM</b></p>
<pre> <pre>
; Program to illustrate searching through a buffer of a specified ; Program to illustrate searching through a buffer of a specified
@ -172,16 +175,20 @@ SearchMaxLengthendp
</tr> </tr>
</table> </table>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="07-03.html">Previous</a></td> <td>
<a href="07-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="07-05.html">Next</a></td> <td>
<a href="07-05.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="08-02.html">Previous</a></td> <td>
<a href="08-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="08-04.html">Next</a></td> <td>
<a href="08-04.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 8.1 L8-1.C</b></p> <p><b>LISTING 8.1 L8-1.C</b></p>
<pre> <pre>
/* Program to search an array spanning a linked list of variable- /* Program to search an array spanning a linked list of variable-
@ -193,16 +196,20 @@ $I265:
$FB264: $FB264:
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="08-02.html">Previous</a></td> <td>
<a href="08-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="08-04.html">Next</a></td> <td>
<a href="08-04.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="09-03.html">Previous</a></td> <td>
<a href="09-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="09-05.html">Next</a></td> <td>
<a href="09-05.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 9.2 L9-2.ASM</b></p> <p><b>LISTING 9.2 L9-2.ASM</b></p>
<pre> <pre>
; Searches a text buffer for a text string. Uses REPNZ SCASB to scan ; Searches a text buffer for a text string. Uses REPNZ SCASB to scan
@ -166,16 +169,20 @@ void main() {
} }
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="09-03.html">Previous</a></td> <td>
<a href="09-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="09-05.html">Next</a></td> <td>
<a href="09-05.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="10-03.html">Previous</a></td> <td>
<a href="10-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="11-01.html">Next</a></td> <td>
<a href="11-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 10.5 L10-5.ASM</b></p> <p><b>LISTING 10.5 L10-5.ASM</b></p>
<pre> <pre>
; Finds and returns the greatest common divisor of two integers. ; Finds and returns the greatest common divisor of two integers.
@ -139,16 +142,20 @@ _gcd endp
<p>And think what you could do with all those extra computer years!</p> <p>And think what you could do with all those extra computer years!</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="10-03.html">Previous</a></td> <td>
<a href="10-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="11-01.html">Next</a></td> <td>
<a href="11-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="13-04.html">Previous</a></td> <td>
<a href="13-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="14-02.html">Next</a></td> <td>
<a href="14-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<h2 id="Heading1">Chapter 14<br /> <h2 id="Heading1">Chapter 14<br />
Boyer-Moore String Searching</h2> Boyer-Moore String Searching</h2>
@ -77,16 +80,20 @@
<p>Actually, yes, we can.</p> <p>Actually, yes, we can.</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="13-04.html">Previous</a></td> <td>
<a href="13-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="14-02.html">Next</a></td> <td>
<a href="14-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="14-04.html">Previous</a></td> <td>
<a href="14-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="14-06.html">Next</a></td> <td>
<a href="14-06.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 14.3 L14-3.ASM</b></p> <p><b>LISTING 14.3 L14-3.ASM</b></p>
<pre> <pre>
; Searches a buffer for a specified pattern. In case of a mismatch, ; Searches a buffer for a specified pattern. In case of a mismatch,
@ -194,16 +197,20 @@ _FindString endp
end end
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="14-04.html">Previous</a></td> <td>
<a href="14-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="14-06.html">Next</a></td> <td>
<a href="14-06.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="14-05.html">Previous</a></td> <td>
<a href="14-05.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="15-01.html">Next</a></td> <td>
<a href="15-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p>Table 14.1 represents a limited and decidedly unscientific comparison of searching techniques. Nonetheless, the overall trend is clear: For all but the shortest patterns, well-implemented Boyer-Moore is generally as good as or better than&mdash;sometimes <i>much</i> better than&mdash;brute-force searching. (For short patterns, you might want to use <b>REPNZ SCASB,</b> thereby getting the best of both worlds.)</p> <p>Table 14.1 represents a limited and decidedly unscientific comparison of searching techniques. Nonetheless, the overall trend is clear: For all but the shortest patterns, well-implemented Boyer-Moore is generally as good as or better than&mdash;sometimes <i>much</i> better than&mdash;brute-force searching. (For short patterns, you might want to use <b>REPNZ SCASB,</b> thereby getting the best of both worlds.)</p>
<p>Know your data and use your smarts. Don&rsquo;t stop thinking just because you&rsquo;re implementing a big-name algorithm; you know more than it does.</p> <p>Know your data and use your smarts. Don&rsquo;t stop thinking just because you&rsquo;re implementing a big-name algorithm; you know more than it does.</p>
@ -196,16 +199,20 @@ _FindString endp
<p>As Yogi Berra might put it, &ldquo;You don&rsquo;t know what you know until you know it.&rdquo;</p> <p>As Yogi Berra might put it, &ldquo;You don&rsquo;t know what you know until you know it.&rdquo;</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="14-05.html">Previous</a></td> <td>
<a href="14-05.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="15-01.html">Next</a></td> <td>
<a href="15-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="14-06.html">Previous</a></td> <td>
<a href="14-06.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="15-02.html">Next</a></td> <td>
<a href="15-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<h2 id="Heading1">Chapter 15<br /> <h2 id="Heading1">Chapter 15<br />
Linked Lists and plain Unintended Challenges</h2> Linked Lists and plain Unintended Challenges</h2>
@ -70,16 +73,20 @@
<p><a id="Fig1"><img src="images/15-01.jpg" /><br /> <p><a id="Fig1"><img src="images/15-01.jpg" /><br />
<b>Figure 15.1</b></a>&nbsp;&nbsp;<i>The basic concept of a linked list.</i></p> <b>Figure 15.1</b></a>&nbsp;&nbsp;<i>The basic concept of a linked list.</i></p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="14-06.html">Previous</a></td> <td>
<a href="14-06.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="15-02.html">Next</a></td> <td>
<a href="15-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="15-01.html">Previous</a></td> <td>
<a href="15-01.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="15-03.html">Next</a></td> <td>
<a href="15-03.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 15.1 L15-1.C</b></p> <p><b>LISTING 15.1 L15-1.C</b></p>
<pre> <pre>
/* Deletes the node in a linked list that follows the indicated node. /* Deletes the node in a linked list that follows the indicated node.
@ -143,16 +146,20 @@ struct LinkNode *FindNodeBeforeValueNotLess(
<p><a id="Fig3"><img src="images/15-03.jpg" /><br /> <p><a id="Fig3"><img src="images/15-03.jpg" /><br />
<b>Figure 15.3</b></a>&nbsp;&nbsp;<i>Representing an empty list.</i></p> <b>Figure 15.3</b></a>&nbsp;&nbsp;<i>Representing an empty list.</i></p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="15-01.html">Previous</a></td> <td>
<a href="15-01.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="15-03.html">Next</a></td> <td>
<a href="15-03.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="15-02.html">Previous</a></td> <td>
<a href="15-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="15-04.html">Next</a></td> <td>
<a href="15-04.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 15.5 L15-5.C</b></p> <p><b>LISTING 15.5 L15-5.C</b></p>
<pre> <pre>
/* Finds the first node in a value-sorted linked list that /* Finds the first node in a value-sorted linked list that
@ -142,16 +145,20 @@ struct LinkNode *InsertNodeSorted(struct LinkNode *HeadOfListNode,
} }
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="15-02.html">Previous</a></td> <td>
<a href="15-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="15-04.html">Next</a></td> <td>
<a href="15-04.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="15-03.html">Previous</a></td> <td>
<a href="15-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-01.html">Next</a></td> <td>
<a href="16-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 15.7 L15-7.ASM</b></p> <p><b>LISTING 15.7 L15-7.ASM</b></p>
<pre> <pre>
; C near-callable assembly function for inserting a new node in a ; C near-callable assembly function for inserting a new node in a
@ -221,16 +224,20 @@ around: ja save
<p>Before I end this chapter, let me say that I get a lot of feedback from my readers, and it&rsquo;s much appreciated. Keep those cards, letters, and email messages coming. And if any of you know Jeannie Schweigert, have her drop me a line and let me know how she&rsquo;s doing these days....</p> <p>Before I end this chapter, let me say that I get a lot of feedback from my readers, and it&rsquo;s much appreciated. Keep those cards, letters, and email messages coming. And if any of you know Jeannie Schweigert, have her drop me a line and let me know how she&rsquo;s doing these days....</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="15-03.html">Previous</a></td> <td>
<a href="15-03.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-01.html">Next</a></td> <td>
<a href="16-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="15-04.html">Previous</a></td> <td>
<a href="15-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-02.html">Next</a></td> <td>
<a href="16-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<h2 id="Heading1">Chapter 16<br /> <h2 id="Heading1">Chapter 16<br />
There Ain&rsquo;t No Such Thing as the Fastest Code</h2> There Ain&rsquo;t No Such Thing as the Fastest Code</h2>
@ -198,16 +201,20 @@
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="15-04.html">Previous</a></td> <td>
<a href="15-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-02.html">Next</a></td> <td>
<a href="16-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="16-02.html">Previous</a></td> <td>
<a href="16-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-04.html">Next</a></td> <td>
<a href="16-04.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 16.4 L16-4.ASM</b></p> <p><b>LISTING 16.4 L16-4.ASM</b></p>
<pre> <pre>
; Assembly subroutine for Listing 16.2. Scans through Buffer, of ; Assembly subroutine for Listing 16.2. Scans through Buffer, of
@ -147,16 +150,20 @@
<p>So how did the entrants in this particular challenge stack up? More than one claimed a speed-up over my assembly word-counting code of more than three times. On top of the three-times speedup over the original C code that I had already realized, we&rsquo;re almost up to an order of magnitude faster. You are, of course, entitled to your own opinion, but <i>I</i> consider an order of magnitude to be significant.</p> <p>So how did the entrants in this particular challenge stack up? More than one claimed a speed-up over my assembly word-counting code of more than three times. On top of the three-times speedup over the original C code that I had already realized, we&rsquo;re almost up to an order of magnitude faster. You are, of course, entitled to your own opinion, but <i>I</i> consider an order of magnitude to be significant.</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="16-02.html">Previous</a></td> <td>
<a href="16-02.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-04.html">Next</a></td> <td>
<a href="16-04.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="16-04.html">Previous</a></td> <td>
<a href="16-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-06.html">Next</a></td> <td>
<a href="16-06.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p>Table 16.2 has two times for each entry listed: the first value is the overall counting time, including time spent in the main program, disk I/O, and everything else; the second value is the time actually spent counting words, the time spent in <b>ScanBuffer</b> . The first value is the time perceived by the user, but the second value best reflects the quality of the optimization in each entry, since the rest of the overall execution time is fixed.</p> <p>Table 16.2 has two times for each entry listed: the first value is the overall counting time, including time spent in the main program, disk I/O, and everything else; the second value is the time actually spent counting words, the time spent in <b>ScanBuffer</b> . The first value is the time perceived by the user, but the second value best reflects the quality of the optimization in each entry, since the rest of the overall execution time is fixed.</p>
<table width="85%"> <table width="85%">
@ -340,16 +343,20 @@ jumping.
end end
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="16-04.html">Previous</a></td> <td>
<a href="16-04.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-06.html">Next</a></td> <td>
<a href="16-06.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="16-06.html">Previous</a></td> <td>
<a href="16-06.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-08.html">Next</a></td> <td>
<a href="16-08.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>Listing 16.6 OPT2.ASM</b></p> <p><b>Listing 16.6 OPT2.ASM</b></p>
<pre> <pre>
; ;
@ -152,16 +155,20 @@
<p><i>&ldquo;My next shot was to get rid of all the branches in the loop. To do that, I reached back to my college hardware courses. I noticed that we were really looking at an edge triggered device we want to count each time the I&rsquo;m a character state goes from one to zero. Remembering that XOR on two single-bit values will always return whether the bits are different or the same, I implemented a transition counter. The counter triggers every time a word begins or ends.&rdquo;</i></p> <p><i>&ldquo;My next shot was to get rid of all the branches in the loop. To do that, I reached back to my college hardware courses. I noticed that we were really looking at an edge triggered device we want to count each time the I&rsquo;m a character state goes from one to zero. Remembering that XOR on two single-bit values will always return whether the bits are different or the same, I implemented a transition counter. The counter triggers every time a word begins or ends.&rdquo;</i></p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="16-06.html">Previous</a></td> <td>
<a href="16-06.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="16-08.html">Next</a></td> <td>
<a href="16-08.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="17-01.html">Previous</a></td> <td>
<a href="17-01.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="17-03.html">Next</a></td> <td>
<a href="17-03.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 17.1 L17-1.CPP</b></p> <p><b>LISTING 17.1 L17-1.CPP</b></p>
<pre> <pre>
/* C++ Game of Life implementation for any mode for which mode set /* C++ Game of Life implementation for any mode for which mode set
@ -288,16 +291,20 @@ void show_text(int x, int y, char *text)
} }
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="17-01.html">Previous</a></td> <td>
<a href="17-01.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="17-03.html">Next</a></td> <td>
<a href="17-03.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="17-06.html">Previous</a></td> <td>
<a href="17-06.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="17-08.html">Next</a></td> <td>
<a href="17-08.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p><b>LISTING 17.5 L17-5.CPP</b></p> <p><b>LISTING 17.5 L17-5.CPP</b></p>
<pre> <pre>
/* C++ Game of Life implementation for any mode for which mode set /* C++ Game of Life implementation for any mode for which mode set
@ -307,16 +310,20 @@ void cellmap::init()
} }
</pre> </pre>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="17-06.html">Previous</a></td> <td>
<a href="17-06.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="17-08.html">Next</a></td> <td>
<a href="17-08.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="17-07.html">Previous</a></td> <td>
<a href="17-07.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="18-01.html">Next</a></td> <td>
<a href="18-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<p>The large model is actually not necessary for the 96x96 cellmap in Listing 17.5. However, I was actually more interested in seeing a fast 200x200 cellmap, and two 200x200 cellmaps can&rsquo;t fit in a single segment. (This can easily be worked around in assembly language for cellmaps up to a segment in size; beyond that size, cellmap scanning becomes pretty complex, although it can still be efficiently implemented with some clever programming.)</p> <p>The large model is actually not necessary for the 96x96 cellmap in Listing 17.5. However, I was actually more interested in seeing a fast 200x200 cellmap, and two 200x200 cellmaps can&rsquo;t fit in a single segment. (This can easily be worked around in assembly language for cellmaps up to a segment in size; beyond that size, cellmap scanning becomes pretty complex, although it can still be efficiently implemented with some clever programming.)</p>
<p>Anyway, using the large model helps illustrate that it&rsquo;s the data representation and the data processing approach you choose that matter most. Optimization details like memory models and segments and in-line functions and assembly language are important but secondary. Let your mind roam creatively before you start coding. Otherwise, you may find you&rsquo;re writing well-tuned slow code, which is by no means the same thing as fast code.</p> <p>Anyway, using the large model helps illustrate that it&rsquo;s the data representation and the data processing approach you choose that matter most. Optimization details like memory models and segments and in-line functions and assembly language are important but secondary. Let your mind roam creatively before you start coding. Otherwise, you may find you&rsquo;re writing well-tuned slow code, which is by no means the same thing as fast code.</p>
@ -48,7 +51,7 @@
<p>No doubt we could get another two to five times improvement with good assembly code&mdash;but that&rsquo;s dwarfed by a 30-times improvement, so optimization at a conceptual level <i>must</i> come first.</p> <p>No doubt we could get another two to five times improvement with good assembly code&mdash;but that&rsquo;s dwarfed by a 30-times improvement, so optimization at a conceptual level <i>must</i> come first.</p>
<h4 align="left" id="Heading11">The Challenge That Ate My Life</h4> <h4 id="Heading11">The Challenge That Ate My Life</h4>
<p>The most recent optimization challenge I laid my community of readers was to write the fastest possible Game of Life generation engine. By &ldquo;engine&rdquo; I meant that I didn&rsquo;t care about time spent in input or output, only time consumed by the call to <b>next-generation.</b> The time spent updating the cellmap was what I wanted people to concentrate on.</p> <p>The most recent optimization challenge I laid my community of readers was to write the fastest possible Game of Life generation engine. By &ldquo;engine&rdquo; I meant that I didn&rsquo;t care about time spent in input or output, only time consumed by the call to <b>next-generation.</b> The time spent updating the cellmap was what I wanted people to concentrate on.</p>
@ -72,16 +75,20 @@
<p>Who won? What did I learn? To find out, read on.</p> <p>Who won? What did I learn? To find out, read on.</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="17-07.html">Previous</a></td> <td>
<a href="17-07.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="18-01.html">Next</a></td> <td>
<a href="18-01.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

View file

@ -1,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -19,17 +18,21 @@
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="17-08.html">Previous</a></td> <td>
<a href="17-08.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="18-02.html">Next</a></td> <td>
<a href="18-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>
<p><br /></p>
<h2 id="Heading1">Chapter 18<br /> <h2 id="Heading1">Chapter 18<br />
It&rsquo;s a plain Wonderful Life</h2> It&rsquo;s a plain Wonderful Life</h2>
@ -63,16 +66,20 @@
<p>Onward to the code.</p> <p>Onward to the code.</p>
<p><br /></p>
<center> <center>
<table border="1"> <table border="1">
<tr> <tr>
<td><a href="17-08.html">Previous</a></td> <td>
<a href="17-08.html">Previous</a>
</td>
<td><a href="index.html">Table of Contents</a></td> <td>
<a href="index.html">Table of Contents</a>
</td>
<td><a href="18-02.html">Next</a></td> <td>
<a href="18-02.html">Next</a>
</td>
</tr> </tr>
</table> </table>
</center> </center>

Some files were not shown because too many files have changed in this diff Show more