abc/src/bool/kit/cloud.c
/**Function********************************************************************

  Synopsis    [This optional function allocates operation cache of the given size.]

  Description [Cache for each operation is allocated independently when the first 
  operation of the given type is performed. The user can allocate cache of his/her 
  preferred size by calling Cloud_CacheAllocate before the first operation of the 
  given type is performed, but this call is optional. Argument "logratio" gives
  the binary logarithm of the ratio of the size of the unique table to that of cache.
  For example, if "logratio" is equal to 3, and the unique table will be 2^3=8 times
  larger than cache; so, if unique table is 2^23 = 8,388,608 nodes, the cache size 
  will be 2^3=8 times smaller and equal to 2^20 = 1,048,576 entries.]
               
  SideEffects []

  SeeAlso     []

******************************************************************************/
Function
Synopsis    [This optional function allocates operation cache of the given size.]

Description [Cache for each operation is allocated independently when the first
operation of the given type is performed. The user can allocate cache of his/her
preferred size by calling Cloud_CacheAllocate before the first operation of the
given type is performed, but this call is optional. Argument "logratio" gives
the binary logarithm of the ratio of the size of the unique table to that of cache.
For example, if "logratio" is equal to 3, and the unique table will be 2^3=8 times
larger than cache; so, if unique table is 2^23 = 8,388,608 nodes, the cache size
will be 2^3=8 times smaller and equal to 2^20 = 1,048,576 entries.]




Function Synopsis [ This optional function allocates operation cache of the given size . ] Description [ Cache for each operation is allocated independently when the first operation of the given type is performed . The user can allocate cache of his / her preferred size by calling Cloud_CacheAllocate before the first operation of the given type is performed but this call is optional . Argument " logratio " gives the binary logarithm of the ratio of the size of the unique table to that of cache . For example if " logratio " is equal to 3 and the unique table will be 2^3 = 8 times larger than cache ; so if unique table is 2^23 = 8 388 608 nodes the cache size will be 2^3 = 8 times smaller and equal to 2^20 = 1 048 576 entries . ]
void Cloud_CacheAllocate( CloudManager * dd, CloudOper oper, int logratio )
{
    assert( logratio > 0 );            
    assert( logratio < dd->bitsNode ); 
    if ( logratio )
    {
        dd->bitsCache[oper]  = dd->bitsNode - logratio;
        dd->shiftCache[oper] = 8*sizeof(unsigned) - dd->bitsCache[oper];
    }
    cloudCacheAllocate( dd, oper );
}
void Cloud_CacheAllocate ( CloudManager * dd , CloudOper oper , int logratio ) { assert ( logratio > 0 ) ; assert ( logratio < dd -> bitsNode ) ; if ( logratio ) { dd -> bitsCache [ oper ] = dd -> bitsNode - logratio ; dd -> shiftCache [ oper ] = 8 * sizeof ( unsigned ) - dd -> bitsCache [ oper ] ; } cloudCacheAllocate ( dd , oper ) ; }
Function
Synopsis    [This optional function allocates operation cache of the given size.]
Function Synopsis [ This optional function allocates operation cache of the given size . ]
// cache cannot be larger than the unique table  // cache cannot be smaller than 2 entries