From 9be1b076934b0410689c857cd71ef7d21a714b5f Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Thu, 6 Sep 2007 08:01:00 -0700 Subject: Version abc70906 --- src/misc/vec/vecStr.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/misc/vec/vecStr.h') diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h index 38ac171d..ecf29f32 100644 --- a/src/misc/vec/vecStr.h +++ b/src/misc/vec/vecStr.h @@ -401,6 +401,27 @@ static inline void Vec_StrPush( Vec_Str_t * p, char Entry ) p->pArray[p->nSize++] = Entry; } +/**Function******************************************************************** + + Synopsis [Finds the smallest integer larger of equal than the logarithm.] + + Description [Returns [Log10(Num)].] + + SideEffects [] + + SeeAlso [] + +******************************************************************************/ +static inline Vec_StrBase10Log( unsigned Num ) +{ + int Res; + assert( Num >= 0 ); + if ( Num == 0 ) return 0; + if ( Num == 1 ) return 1; + for ( Res = 0, Num--; Num; Num /= 10, Res++ ); + return Res; +} /* end of Extra_Base2Log */ + /**Function************************************************************* Synopsis [] @@ -425,7 +446,7 @@ static inline void Vec_StrPrintNum( Vec_Str_t * p, int Num ) Vec_StrPush( p, (char)('0' + Num) ); return; } - nDigits = Extra_Base10Log( Num ); + nDigits = Vec_StrBase10Log( Num ); Vec_StrGrow( p, p->nSize + nDigits ); for ( i = nDigits - 1; i >= 0; i-- ) { -- cgit v1.2.3