Return to BSD News archive
Newsgroups: comp.os.386bsd.development Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!gatech!news-feed-1.peachnet.edu!umn.edu!csus.edu!netcom.com!jmonroy From: jmonroy@netcom.com (Jesus Monroy Jr) Subject: Correction, Correction, Appologizes..... Message-ID: <jmonroyC6A4u2.LL4@netcom.com> Keywords: error correction qic news Organization: NETCOM On-line Communication Services (408 241-9760 guest) Date: Fri, 30 Apr 1993 04:37:13 GMT Lines: 148 CORRECTIONs, CORRECTIONS, APPOLOGIES ==================================== In my ramblings, I have made some errors. What follows are the corrections as they pertain to the listed article, sorry I don't have the dates posted for all the article. I have condensed the articles for purposes of not costing the NET "hundreds if not millions of dollars". FROM: Kindeling Material.... Send you flames in early ===================================================== BIT MANIPULATION ---------------- :: [deleted stuff] :: /* this will run a lot faster and better */ #define STOP 2 #define GO 1 #define INIT_VAR 3 /* prototype for ANSI */ void loop_de_loop2(void); /* a better way */ loop_de_loop2() { int move = INIT_VAR; /* "move" is not important to anything */ #ifdef CORRECTION while ((move & (STOP | GO) == (STOP | GO)) #else while (move & (STOP | GO)) #endif { move = external_stuff; :: :: /* this is implicit logic, it works just like the previous */ move &= (STOP | GO); } return; } We have removed at least 3 conditional jumps from the #ifdef CORRECTION assembly code, just by this logic. We have also removed 2 #else assembly code, just by this logic. We have also removed 3 #endif comparisons & 2 data references from the stack. USING DUMB MATH --------------- :: [deleted stuff] :: #define find() find_sec_no() /* better */ find() { sec_no++; glob_err = (sec_no >= sectors_pertrack) ? { head++; sec_no = 0;} : #ifdef CORRECTION (head > head_pertrack) ? {seek(track++); head = 0;}:; #else (head > head_pertrack) ? seek(track++) : report_err(); #endif /* may you would like this better */ /* if (sec_no >= sectors_pertrack) { head++; sec_no = 0; #ifdef CORRECTION }else { if (head > head_pertrack) { seek(track++); head = 0; } } /* else glob_err = report_err(); */ #else }else if (head > head_pertrack) seek(track++) else glob_err = report_err(); #endif */ return sec_no; } FROM: QIC NEWS vol.3 no.1 ===================================================== >> Unsure About Library Calls >> ---------------------------- >> :: [deleted stuff] :: >> >>This code clip shows the right way and wrong way. >> >> ;; wrong way >> outw dx, ax ;; write a word (16-bits) to a port >> >> ;; right way >> outb dx, al ;; write the LSB (least significant byte) >> xchg al,ah ;; exchange high for low >> nop ;; wait settle time (about 2 clock cycles) >> outb dx, al ;; write new LSB >> ^^ I should have qualified the above example better. It just seems that too many people complained about the methodology and had a valid point, although they did stray from the subject at hand. APPOLOGIES ===================================================== APPOLOGIES to ALL whom I have flamed or kindeled in the past, as I would like more responses that really, in my eye, seem to nit-pick. These reponses really remind me that I must do a better job. Thank you for your attention. ___________________________________________________________________________ Jesus Monroy Jr jmonroy@netcom.com /386BSD/device-drivers /fd /qic /clock /documentation ___________________________________________________________________________