Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3EA5B801.AB1ED518@phekda.freeserve.co.uk> Date: Tue, 22 Apr 2003 22:45:37 +0100 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: Eric Rudd CC: djgpp-workers AT delorie DOT com, DJGPP newsgroup Subject: Re: Bug 00314 -- div() still broken References: <3EA54F78 DOT C46438ED AT phekda DOT freeserve DOT co DOT uk> <3EA57418 DOT 2060506 AT cyberoptics DOT com> <3EA5789C DOT F1E0CFBB AT phekda DOT freeserve DOT co DOT uk> <3EA57D64 DOT 4030000 AT cyberoptics DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Eric Rudd wrote: > > Richard Dawe wrote: > > > I thought maybe someone knew something I didn't. Like: perhaps this code > > gives the correct behaviour with long long, but smaller types don't need > > it? > > > According to C99: > > 7.20.6.2 The div, ldiv, and lldiv functions > > [#2] The div, ldiv, and lldiv, functions compute numer / > denom and numer % denom in a single operation. > > so if special tests were needed for lldiv, then there would be something > wrong with / or % for long longs, which would need to be fixed instead. True. I've fixed lldiv in the same way as div, ldiv. I also swapped the order of calculation of r.quot, r.rem like you did for div, ldiv - r.rem is done first. I've committed the fix to CVS. Bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]