    /*
     *  call-seq:
     *     bv.each { |bit_num| }
     *
     *  Iterate through all the set bits in the bit vector yielding each one in
     *  order
     */
    VALUE
    frb_bv_each(VALUE self)
    {
        BitVector *bv;
        int bit;
        GET_BV(bv, self);
        bv_scan_reset(bv);
        if (bv->extends_as_ones) {
            while ((bit = bv_scan_next_unset(bv)) >= 0) {
                rb_yield(INT2FIX(bit));
            }
        }
        else {
            while ((bit = bv_scan_next(bv)) >= 0) {
                rb_yield(INT2FIX(bit));
            }
        }
        return self;
    }