changed: UInt::Div3_Normalize - faster now
git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@101 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -1450,9 +1450,9 @@ public:
|
||||
__asm__ __volatile__(
|
||||
|
||||
"bsrl %1, %0 \n"
|
||||
"jnz 1f \n"
|
||||
"movl $-1, %0 \n"
|
||||
"1: \n"
|
||||
"jnz 1f \n"
|
||||
"movl $-1, %0 \n"
|
||||
"1: \n"
|
||||
|
||||
: "=R" (result)
|
||||
: "R" (x)
|
||||
@@ -2627,23 +2627,25 @@ private:
|
||||
*/
|
||||
uint Div3_Normalize(UInt<value_size> & v, uint n, uint & d)
|
||||
{
|
||||
uint c = 0;
|
||||
// v.table[n-1] is != 0
|
||||
|
||||
// !!!!!!!!! change
|
||||
for( d = 0 ; (v.table[n-1] & TTMATH_UINT_HIGHEST_BIT) == 0 ; ++d )
|
||||
uint bit = (uint)FindLeadingBitInWord(v.table[n-1]);
|
||||
uint move = (TTMATH_BITS_PER_UINT - bit - 1);
|
||||
uint res = table[value_size-1];
|
||||
d = move;
|
||||
|
||||
if( move > 0 )
|
||||
{
|
||||
// we can move the bits only to the 'n-1' index but at the moment
|
||||
// we don't have such method
|
||||
// maybe it's time to write it now?
|
||||
v.Rcl(1, 0);
|
||||
|
||||
c <<= 1;
|
||||
|
||||
if( Rcl(1, 0) )
|
||||
c += 1;
|
||||
v.Rcl(move, 0);
|
||||
Rcl(move, 0);
|
||||
res = res >> (bit + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = 0;
|
||||
}
|
||||
|
||||
return c;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -826,9 +826,9 @@ namespace ttmath
|
||||
__asm__ __volatile__(
|
||||
|
||||
"bsrq %1, %0 \n"
|
||||
"jnz 1f \n"
|
||||
"movq $-1, %0 \n"
|
||||
"1: \n"
|
||||
"jnz 1f \n"
|
||||
"movq $-1, %0 \n"
|
||||
"1: \n"
|
||||
|
||||
: "=R" (result)
|
||||
: "R" (x)
|
||||
|
Reference in New Issue
Block a user