mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Pass numbers in the remaining arithmetic functions by const reference
This commit is contained in:
parent
b6738d00f4
commit
89e454a65b
3 changed files with 10 additions and 10 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
void _mulnumx( NUMBER *pa, NUMBER b );
|
||||
void _mulnumx( NUMBER *pa, const NUMBER &b );
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -78,13 +78,13 @@ void __inline mulnumx( NUMBER *pa, const NUMBER &b )
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void _mulnumx( NUMBER *pa, NUMBER b )
|
||||
void _mulnumx( NUMBER *pa, const NUMBER &b )
|
||||
|
||||
{
|
||||
NUMBER c; // c will contain the result.
|
||||
NUMBER a; // a is the dereferenced number pointer from *pa
|
||||
vector<MANTTYPE>::iterator ptra; // ptra is an iterator pointing to the mantissa of a.
|
||||
vector<MANTTYPE>::iterator ptrb; // ptrb is an iterator pointing to the mantissa of b.
|
||||
vector<MANTTYPE>::const_iterator ptrb; // ptrb is an iterator pointing to the mantissa of b.
|
||||
vector<MANTTYPE>::iterator ptrc; // ptrc is an iterator pointing to the mantissa of c.
|
||||
vector<MANTTYPE>::iterator ptrcoffset; // ptrcoffset, is the anchor location of the next
|
||||
// single digit multiply partial result.
|
||||
|
@ -201,7 +201,7 @@ void numpowi32x( _Inout_ NUMBER *proot, _In_ int32_t power )
|
|||
|
||||
}
|
||||
|
||||
void _divnumx( NUMBER *pa, NUMBER b, int32_t precision);
|
||||
void _divnumx( NUMBER *pa, const NUMBER &b, int32_t precision);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -218,7 +218,7 @@ void _divnumx( NUMBER *pa, NUMBER b, int32_t precision);
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void __inline divnumx( NUMBER *pa, NUMBER b, int32_t precision)
|
||||
void __inline divnumx( NUMBER *pa, const NUMBER &b, int32_t precision)
|
||||
|
||||
{
|
||||
if ( b.cdigit > 1 || b.mant[0] != 1 || b.exp != 0 )
|
||||
|
@ -257,7 +257,7 @@ void __inline divnumx( NUMBER *pa, NUMBER b, int32_t precision)
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void _divnumx( NUMBER *pa, NUMBER b, int32_t precision)
|
||||
void _divnumx( NUMBER *pa, const NUMBER &b, int32_t precision)
|
||||
|
||||
{
|
||||
NUMBER a; // a is the dereferenced number pointer from *pa
|
||||
|
|
|
@ -65,7 +65,7 @@ void rshrat( PRAT *pa, PRAT b, uint32_t radix, int32_t precision)
|
|||
}
|
||||
|
||||
void boolrat( PRAT *pa, PRAT b, int func, uint32_t radix, int32_t precision);
|
||||
void boolnum( NUMBER *pa, NUMBER b, int func );
|
||||
void boolnum( NUMBER *pa, const NUMBER &b, int func );
|
||||
|
||||
|
||||
enum {
|
||||
|
@ -130,13 +130,13 @@ void boolrat( PRAT *pa, PRAT b, int func, uint32_t radix, int32_t precision)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void boolnum( NUMBER *pa, NUMBER b, int func )
|
||||
void boolnum( NUMBER *pa, const NUMBER &b, int func )
|
||||
|
||||
{
|
||||
NUMBER c;
|
||||
NUMBER a;
|
||||
vector<MANTTYPE>::iterator pcha;
|
||||
vector<MANTTYPE>::iterator pchb;
|
||||
vector<MANTTYPE>::const_iterator pchb;
|
||||
vector<MANTTYPE>::iterator pchc;
|
||||
int32_t cdigits;
|
||||
int32_t mexp;
|
||||
|
|
|
@ -566,7 +566,7 @@ void _dumprawrat( const wchar_t *varname, PRAT rat, wostream& out)
|
|||
//
|
||||
// FUNCTION: _dumprawnum
|
||||
//
|
||||
// ARGUMENTS: const wchar *name of variable, NUMBER num, output stream out
|
||||
// ARGUMENTS: const wchar *name of variable, const NUMBER &num, output stream out
|
||||
//
|
||||
// RETURN: none, prints the results of a dump of the internal structures
|
||||
// of a NUMBER, suitable for READRAWNUM to stderr.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue