/*
 *  call-seq:
 *     str.reverse!   => str
 *  
 *  Reverses <i>str</i> in place.
 */

static VALUE
rb_str_reverse_bang(str)
    VALUE str;
{
    char *s, *e;
    char c;

    if (RSTRING(str)->len > 1) {
        rb_str_modify(str);
        s = RSTRING(str)->ptr;
        e = s + RSTRING(str)->len - 1;
        while (s < e) {
            c = *s;
            *s++ = *e;
            *e-- = c;
        }
    }
    return str;
}