ffs.h 431 B

12345678910111213141516171819202122232425262728
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * OpenRISC Linux
  4. *
  5. * Copyright (C) 2010-2011 Jonas Bonn <[email protected]>
  6. */
  7. #ifndef __ASM_OPENRISC_FFS_H
  8. #define __ASM_OPENRISC_FFS_H
  9. #ifdef CONFIG_OPENRISC_HAVE_INST_FF1
  10. static inline int ffs(int x)
  11. {
  12. int ret;
  13. __asm__ ("l.ff1 %0,%1"
  14. : "=r" (ret)
  15. : "r" (x));
  16. return ret;
  17. }
  18. #else
  19. #include <asm-generic/bitops/ffs.h>
  20. #endif
  21. #endif /* __ASM_OPENRISC_FFS_H */