    /*
     *  call-seq:
     *     bv[i] = bool  -> bool
     *
     *  Set the bit and _i_ to *val* (+true+ or
     *  +false+).
     */
    VALUE
    frb_bv_set(VALUE self, VALUE rindex, VALUE rstate)
    {
        BitVector *bv;
        int index = FIX2INT(rindex);
        GET_BV(bv, self);
        if (index < 0) {
            rb_raise(rb_eIndexError, "%d < 0", index);
        }
        if (RTEST(rstate)) {
            bv_set(bv, index);
        }
        else {
            bv_unset(bv, index);
        }

        return rstate;
    }