micro-optim: use __builtin_ffs for k