s guaranteed to return the correct
    integer value if the input is an integer exact power of 2.
    r