The need for D-scussion (was Re: D Wishlist)
Tim Olson
tim at amdcad.AMD.COM
Tue Mar 15 04:29:07 AEST 1988
In article <3732 at bloom-beacon.MIT.EDU> tada at athena.mit.edu (Michael Zehr) writes:
|
| Here's another one for the D wishlist:
|
| a function the returns both a % b and a / b at the same time.
|
| I know I've had to call those routines with the same values consecutively
| in code that needed to run fast, and if i understand the library right, they
| both compute the pair of values, but a different one is returned. Why not
| give the option of getting them both at the same time?
If you have a good compiler, you can already get this. The low-level
divide function for the MetaWare - Am29000 C compiler returns the /
value in the specified register, and returns the % value in the standard
function return-value register. Therefore, in code like
while (n > 0) {
buf[i++] = (n%10) + '0';
n /= 10;
}
only one call to the low-level divide routine is made.
-- Tim Olson
Advanced Micro Devices
(tim at amdcad.amd.com)
More information about the Comp.lang.c
mailing list