Blast-Radius Aware AI Code Review for Business-Critical Systems
LiveReview LiveReview Explore LiveReview

findMSB - find the index of the most significant bit set to 1 in an integer

Declaration

genITypefindMSB(genITypevalue);genITypefindMSB(genUTypevalue);

Description

findMSB returns the bit number of the most significant bit that is set to 1 in the binary representation
       of value. For positive integers, the result will be the bit number of the most significant bit that is
       set to 1. For negative integers, the result will be the bit number of the most significant bit set to 0.
       For a value of zero or negative 1, -1 will be returned.

Name

       findMSB - find the index of the most significant bit set to 1 in an integer

Parameters

value
           Specifies the value whose bits to scan.

See Also

findLSB()

Version Support

       ┌──────────┬───────────────────────────────────────────────────────────────────────────────────┐
       │          │        OpenGLShadingLanguageVersion                                            │
       ├──────────┼──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┤
       │ Function │ 1.10 │ 1.20 │ 1.30 │ 1.40 │ 1.50 │ 3.30 │ 4.00 │ 4.10 │ 4.20 │ 4.30 │ 4.40 │ 4.50 │
       │ Name     │      │      │      │      │      │      │      │      │      │      │      │      │
       ├──────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
       │ findMSB  │  -   │  -   │  -   │  -   │  -   │  -   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │
       └──────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘

See Also