I'm trying to make a program which prints out the position of the leftmost 1 bit in C, but without loops.
This is what I've gathered so far:
#include<stdio.h>
int main() {
    unsigned int x, y;
    printf("Enter an integer: ");
    scanf("%d", &x);
    // Bit 
    x |= x >> 4;
    x |= x >> 2;
    x |= x >> 1;
    x ^= x >> 1;
    printf("\n%d", x);
    return 0;
}
This prints out the leftmost bit as an integer, but I'm having trouble converting it to the position of its highest set bit.
128 should be 8 (1000 0000) 64 should be 7 (0100 0000)
