group/pintos/src/lib/kernel/bitmap.c
/* Returns the number of bits in B between START and START + CNT,
   exclusive, that are set to VALUE. */
Returns the number of bits in B between START and START + CNT,
exclusive, that are set to VALUE.
Returns the number of bits in B between START and START + CNT exclusive that are set to VALUE .
size_t
bitmap_count (const struct bitmap *b, size_t start, size_t cnt, bool value)
{
  size_t i, value_cnt;
  ASSERT (b != NULL);
  ASSERT (start <= b->bit_cnt);
  ASSERT (start + cnt <= b->bit_cnt);
  value_cnt = 0;
  for (i = 0; i < cnt; i++)
    if (bitmap_test (b, start + i) == value)
      value_cnt++;
  return value_cnt;
}
size_t bitmap_count ( const struct bitmap * b , size_t start , size_t cnt , bool value ) { size_t i , value_cnt ; ASSERT ( b != NULL ) ; ASSERT ( start <= b -> bit_cnt ) ; ASSERT ( start + cnt <= b -> bit_cnt ) ; value_cnt = 0 ; for ( i = 0 ; i < cnt ; i ++ ) if ( bitmap_test ( b , start + i ) == value ) value_cnt ++ ; return value_cnt ; }
Returns the number of bits in B between START and START + CNT,
exclusive, that are set to VALUE.
Returns the number of bits in B between START and START + CNT exclusive that are set to VALUE .