Allocated Limbs

LingWitt@insightbb.com LingWitt@insightbb.com
Tue, 24 Jun 2003 23:46:19 -0400


--Apple-Mail-2-896168289
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

This is what you meant:

unsigned int stripLowZeroLimbs(mpf_ptr f)
{
     unsigned 	sizeNew, sizeOld;
     sizeNew = sizeOld = f->_mp_size;
     mp_ptr	limbs			= f->_mp_d;
     mp_ptr	limb			= 0;

     while (*(limb = limbs++) == 0)
         sizeNew--;

     if (sizeNew == sizeOld)
         return 0;
	
     f->_mp_size = sizeNew;

     mp_ptr newLimbs = f->_mp_d;
     limbs--;
     for (unsigned int index = 0; index < sizeNew; index++)
         newLimbs[index] = *(limbs++);

     return sizeOld - f->_mp_size;
}

On Tuesday, Jun 24, 2003, at 20:04 America/New_York, Kevin Ryde wrote:

> move the array
> elements (ie. limbs) within it.
--Apple-Mail-2-896168289
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
	charset=US-ASCII

<fixed><color><param>7672,0F0B,504C</param>This is what you meant:


unsigned</color> <color><param>7672,0F0B,504C</param>int</color>
stripLowZeroLimbs(mpf_ptr f)

{

    <color><param>7676,0F0F,5050</param>unsigned</color> 	sizeNew,
sizeOld;

    sizeNew = sizeOld = f->_mp_size;

    mp_ptr	limbs			= f->_mp_d;

    mp_ptr	limb			= <color><param>0000,0000,FFFF</param>0</color>;

    

    <color><param>7676,0F0F,5050</param>while</color> (*(limb =
limbs++) == <color><param>0000,0000,FFFF</param>0</color>)

        sizeNew--;

    

    <color><param>7676,0F0F,5050</param>if</color> (sizeNew == sizeOld)

        <color><param>7676,0F0F,5050</param>return</color>
<color><param>0000,0000,FFFF</param>0</color>;

	

    f->_mp_size = sizeNew;

    

    mp_ptr newLimbs = f->_mp_d;

    limbs--;

    <color><param>7676,0F0F,5050</param>for</color>
(<color><param>7676,0F0F,5050</param>unsigned</color>
<color><param>7676,0F0F,5050</param>int</color> index = 0; index <<
sizeNew; index++)

        newLimbs[index] = *(limbs++);

    

    <color><param>7676,0F0F,5050</param>return</color> sizeOld -
f->_mp_size;

}

</fixed>

On Tuesday, Jun 24, 2003, at 20:04 America/New_York, Kevin Ryde wrote:


<excerpt>move the array

elements (ie. limbs) within it.</excerpt>
--Apple-Mail-2-896168289--