H
Howard
Hi,
I know I can do integer division with the / operator, and get the
modulus with the % operator, but is there any function that calculates both
values in one shot? It seems quite wasteful in time to do the division
twice in order to get both of those values, when it would be quite easy to
return them both from a single function.
I saw someone's code implementing a divmod() function using assembler.
But it doesn't look like there is a built-in function for doing that in C++,
correct? Seeing as how I do a lot of mathematical calculations, I'm
thinking of writing one myself, but writing one in assembler is
platform-specific, and writing one in C++ doesn't seem logical. It seems to
me that it ought to part of the C++ standard, and implemented by compiler
vendors to target the specific platform(s) they support.
Any thoughts? (Or perhaps I should take this to comp.std.c++?)
-Howard
I know I can do integer division with the / operator, and get the
modulus with the % operator, but is there any function that calculates both
values in one shot? It seems quite wasteful in time to do the division
twice in order to get both of those values, when it would be quite easy to
return them both from a single function.
I saw someone's code implementing a divmod() function using assembler.
But it doesn't look like there is a built-in function for doing that in C++,
correct? Seeing as how I do a lot of mathematical calculations, I'm
thinking of writing one myself, but writing one in assembler is
platform-specific, and writing one in C++ doesn't seem logical. It seems to
me that it ought to part of the C++ standard, and implemented by compiler
vendors to target the specific platform(s) they support.
Any thoughts? (Or perhaps I should take this to comp.std.c++?)
-Howard