libs/gen/src/genMask.cxx
//
// Make sure the set has sufficient space to hold the given range of values.
// If 'clear' is nonzero, clear out any newly-allocated space.
//
Make sure the set has sufficient space to hold the given range of values.
If 'clear' is nonzero, clear out any newly-allocated space.
Make sure the set has sufficient space to hold the given range of values . If ' clear ' is nonzero clear out any newly - allocated space .
void genMask::_provide (unsigned range, int clear)
{
    if (range > _cap) {
	unsigned g = (range + _ulbits - 1) / _ulbits;
	unsigned w = _words;
	if (w < 1) w = 1;
	while (w < g) w <<= 1;
	if (_mask)
	    _mask = (unsigned long *) psetrealloc ((char *) _mask, w * _ulsize);
	else _mask = (unsigned long *) psetmalloc (w * _ulsize);
	if (clear)
	    OS_dependent::bzero (_mask + _words, (w - _words) * _ulsize);
	_words = w;
	_cap = _words * _ulbits;
    }
}
void genMask :: _provide ( unsigned range , int clear ) { if ( range > _cap ) { unsigned g = ( range + _ulbits - 1 ) / _ulbits ; unsigned w = _words ; if ( w < 1 ) w = 1 ; while ( w < g ) w <<= 1 ; if ( _mask ) _mask = ( unsigned long * ) psetrealloc ( ( char * ) _mask , w * _ulsize ) ; else _mask = ( unsigned long * ) psetmalloc ( w * _ulsize ) ; if ( clear ) OS_dependent :: bzero ( _mask + _words , ( w - _words ) * _ulsize ) ; _words = w ; _cap = _words * _ulbits ; } }
Make sure the set has sufficient space to hold the given range of values.
Make sure the set has sufficient space to hold the given range of values .