Re: Modulo n arithmetics

wendt@CS.ColoState.EDU (alan l wendt)
Sun, 15 Nov 1992 16:39:06 GMT

          From comp.compilers

Related articles
Modulo n arithmetics fabre@gr.osf.org (Christian Fabre) (1992-11-06)
Re: Modulo n arithmetics pardo@cs.washington.edu (1992-11-10)
Re: Modulo n arithmetics drclark@daisy.uwaterloo.ca (David R. Clark) (1992-11-11)
Re: Modulo n arithmetics dneedham@oucsace.cs.ohiou.edu (1992-11-11)
Modulo n arithmetics wchsieh@beethoven.lcs.mit.edu (1992-11-11)
Re: Modulo n arithmetics wendt@CS.ColoState.EDU (1992-11-15)
Re: Modulo n arithmetics johnr@ee.uts.edu.au (1992-11-17)
Re: Modulo n arithmetics chris@gargoyle.uchicago.edu (1992-11-19)
Re: Modulo n arithmetics tve@crackle.CS.Berkeley.EDU (1992-11-20)
Re: Modulo n arithmetics pcg@aber.ac.uk (1992-11-29)
| List of all articles for this month |

Newsgroups: comp.compilers
From: wendt@CS.ColoState.EDU (alan l wendt)
Organization: Colorado State University, Computer Science Department
Date: Sun, 15 Nov 1992 16:39:06 GMT
Followup-To: comp.programming
Keywords: arithmetic
References: 92-11-029 92-11-043

Speaking of modulo-n buffering systems. This is really the wrong group
but I cannot help mentioning that the traditional head-and-tail pointer
technique for circular buffering is the wrong way to do it. The problem
is that head==tail can mean that the queue is empty or that the queue is
full, so most implementations waste a queue entry so that the queue never
really gets full.


If the algorithm maintains the queue head pointer and the queue length,
instead of head and tail, the two cases can be disambiguated easily!


Horowitz & Sahni (Fundamentals of Computer Algorithms) suggest that one
might maintain an additional boolean to disambiguate the two situations,
which I take as evidence that this idea is not widely disseminated.


Alan Wendt
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.