Re: gb_t and memMeter

From: Adrian Chadd <adrian@dont-contact.us>
Date: Tue, 1 May 2001 00:25:50 +0800

On Mon, Apr 30, 2001, Alex Rousskov wrote:

> > Use a quad_t. That avoids an FPU operation.
>
> IIRC, the original reason for gb_t was the precision. Double counters
> might miss a few bytes as they become large. Whether the precision is
> important for current applications of gb_t is a separate question.

Right.

> If you end up using doubles or quad_t (how portable is that?) instead,
> please make sure that we never convert your counter or its derivative
> to an "int" using a C cast because such a conversion may cause an
> arithmetic exception.

quad_t is on the platforms I use (tru64, linux, freebsd, solaris).
long long might be the go on other platforms.

The typecast from quad to int won't generate an exception, it'll
just get the lower bits. The compiler can warn you with -Wall.
I've *so* been bitten by that. :-)

Adrian

-- 
Adrian Chadd			"Two hundred and thirty-three thousand
<adrian@creative.net.au>	  times the speed of light.
			 	   Dear holy fucking shit."
Received on Mon Apr 30 2001 - 10:29:10 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:51 MST