# fn() bitScanReverse
Returns the index of the last set bit in the binary representation of the given value.

Defined in | <seqan/misc.h>
Signature | `TWord bitScanReverse(val)`

## Parameters

`val` | The value to scan. Has to be non-zero.

## Return Values

`TWord` | The index of the last set bit in `val`, where `TWord` is the value of `val`.

## Detailed Description

Note:

If `val` is 0 the return value is undefined.

## Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

## See Also

- bitScanForward

#### Dox Sources

    /*!
     * @fn bitScanReverse
     *
     * @headerfile <seqan/misc.h>
     *
     * @brief Returns the index of the last set bit in the binary representation of
     *        the given value.
     *
     * @note If <tt>val</tt> is 0 the return value is undefined.
     *
     * @signature TWord bitScanReverse(val)
     *
     * @param[in] val The value to scan. Has to be non-zero.
     *
     * @return TWord The index of the last set bit in <tt>val</tt>, where
     *               <tt>TWord</tt> is the value of <tt>val</tt>.
     *
     * @see bitScanForward
     */