Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Jul 1999 13:23:09 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        hibma@skylink.it, mjacob@FreeBSD.org
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org
Subject:   Re: cvs commit: src/sys/cam/scsi scsi_da.c
Message-ID:  <199907040323.NAA21605@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>The compiler was not _that_ stupid. It just did not rewrite 
>
>	a/(b/c)
>
>into 
>
>	a*c/b
>
>which is kind of fair, if you don't want to have problems with
>difference in precision (int() calculations):
>
>	4/(3/2) = 4/1 = 4 != 4*2/3 = 2

The previous programmer was not that stupid either.  He rewrote a*c/b to
a/(b/c) in rev.1.5 (1993/08/21) of scsi/sd.c to avoid overflow of a*c
for disks larger than 4G on 32-bit systems.  The compiler then can't
"optimise" back to a*c/b even if it knows that c divides b unless it
also knows that there is no overflow (or that c == 0 so that the result
is undefined).

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907040323.NAA21605>