source/BitVector.h
/// Helper for calling SHIFT with negative number
Helper for calling SHIFT with negative number
Helper for calling SHIFT with negative number
void ShiftRight(const size_t shift_size) {
      const size_t field_shift = shift_size / FIELD_BITS;
      const size_t bit_shift = shift_size % FIELD_BITS;
      const size_t bit_overflow = FIELD_BITS - bit_shift;
      const size_t NUM_FIELDS = NumFields();
      const size_t field_shift2 = NUM_FIELDS - field_shift;
      if (field_shift) {
        for (size_t i = 0; i < field_shift2; ++i) {
          bit_set[i] = bit_set[i + field_shift];
        }
        for (size_t i = field_shift2; i < NUM_FIELDS; i++) bit_set[i] = 0U;
      }
      if (bit_shift) {
        for (size_t i = 0; i < (field_shift2 - 1); ++i) {
          bit_set[i] >>= bit_shift;
          bit_set[i] |= (bit_set[i+1] << bit_overflow);
        }
        bit_set[field_shift2 - 1] >>= bit_shift;
      }
    }
void ShiftRight ( const size_t shift_size ) { const size_t field_shift = shift_size / FIELD_BITS ; const size_t bit_shift = shift_size % FIELD_BITS ; const size_t bit_overflow = FIELD_BITS - bit_shift ; const size_t NUM_FIELDS = NumFields ( ) ; const size_t field_shift2 = NUM_FIELDS - field_shift ; if ( field_shift ) { for ( size_t i = 0 ; i < field_shift2 ; ++ i ) { bit_set [ i ] = bit_set [ i + field_shift ] ; } for ( size_t i = field_shift2 ; i < NUM_FIELDS ; i ++ ) bit_set [ i ] = 0U ; } if ( bit_shift ) { for ( size_t i = 0 ; i < ( field_shift2 - 1 ) ; ++ i ) { bit_set [ i ] >>= bit_shift ; bit_set [ i ] |= ( bit_set [ i + 1 ] << bit_overflow ) ; } bit_set [ field_shift2 - 1 ] >>= bit_shift ; } }
Helper for calling SHIFT with negative number
Helper for calling SHIFT with negative number
// account for field_shift // account for bit_shift