"royvharrington" <roy@...> writes:
> >
> > > What C construct are you going to use to
> > > test the carry bit out of the last arithmetic add? Write me the
> code.
> > > If you prefer a different high level lang, use that.
> >
> > That's up to the C compiler what it does. Different C compilers
> will do
> > different things with the same constructs. You should know
> that.
> >
>
> I know what C compilers do. I want to know what YOU are going
> to give the C compiler to compile i.e. I want YOUR source
> code. If you've written so much C code you ought to be able to
> write
> a couple of lines of C code that adds 2 unsigned 16 bit numbers
> and forces the result to the maximum unsigned 16 bit number if
> there is
> overflow. I want ordinary C code that could be compiled on
> any computer with a C compiler on it and will work identically
> and correctly on every single one.
Heh. I'd do the arithmetic in 32-bit and then test if the result
exceeded the 16-bit unsigned max and chop it if it did :-).
Unless hardware or performance constraints mandated some other
approach anyway.
From which you may deduce that that's not the sort of problem I spend
most of my time on; I fall back on the brute force approach when
possible.
--
David Dyer-Bennet, dd-b@... / New TMDA anti-spam in test
John Dyer-Bennet 1915-2002 Memorial Site http://john.dyer-bennet.net
Book log: http://www.dd-b.net/dd-b/Ouroboros/booknotes/
New Dragaera mailing lists, see http://dragaera.infoMessage
Re: [Digital BW] Number of tones was Re: Do inkjets dither or not?
2002-08-07 by David Dyer-Bennet
Attachments
- No local attachments were found for this message.