I'd say why bother? Gcc+Clang give you "__builtin_ffs" which should result in good machine code for any arch.