__fls.h 671 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * OpenRISC Linux
  3. *
  4. * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef __ASM_OPENRISC___FLS_H
  12. #define __ASM_OPENRISC___FLS_H
  13. #ifdef CONFIG_OPENRISC_HAVE_INST_FL1
  14. static inline unsigned long __fls(unsigned long x)
  15. {
  16. int ret;
  17. __asm__ ("l.fl1 %0,%1"
  18. : "=r" (ret)
  19. : "r" (x));
  20. return ret-1;
  21. }
  22. #else
  23. #include <asm-generic/bitops/__fls.h>
  24. #endif
  25. #endif /* __ASM_OPENRISC___FLS_H */