I already know about the standard C library functions and have used that one many times.
I used my function to describe the question better,
even still I cannot figure out how to use binary numbers without having to convert them to decimal first.
I still think my function uses less instructions though