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

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

## Parameters

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

## Return Values

`TWord` | The index of the first 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

- bitScanReverse

#### Dox Sources

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