x86 assembly, six instructions, no branches or loops
Assuming input in %edi, output in %eax.\n\n\nmovl $31, %ecx\nlzcntl  %edi, %eax\ncmovbl  %ecx, %eax\nnotl    %edi\nshlxl   %eax, %edi, %ecx\nshrxl   %eax, %ecx,
Assuming input in `%edi`, output in `%eax`.\n\n```\nmovl $31, %ecx\nlzcntl  %edi, %eax\ncmovbl  %ecx, %eax\nnotl    %edi\nshlxl   %eax, %edi, %ecx\nshrxl   %eax, %ecx, %eax\n```
[]