__builtin_ctz

C++
// C program to illustrate __builtin_ctz(x) 
#include <stdio.h> 
int main() 
{ 
    int n = 16; 
      
    printf("Count of zeros from last to first "
           "occurrence of one is %d", 
           __builtin_ctz(n)); 
    return 0; 
} 
a = 16
Binary form of 16 is 00000000 00000000 00000000 00010000
Output: ctz = 4

Source

Also in C++: