Stefan Kristiansson | 6e560bb | 2011-11-26 19:04:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * OpenRISC Linux |
| 3 | * |
| 4 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> |
| 5 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Stefan Kristiansson | 6e560bb | 2011-11-26 19:04:49 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef __ASM_OPENRISC_FFS_H |
| 10 | #define __ASM_OPENRISC_FFS_H |
| 11 | |
| 12 | static inline int ffs(int x) |
| 13 | { |
| 14 | int ret; |
| 15 | |
| 16 | __asm__ ("l.ff1 %0,%1" |
| 17 | : "=r" (ret) |
| 18 | : "r" (x)); |
| 19 | |
| 20 | return ret; |
| 21 | } |
| 22 | |
| 23 | #endif /* __ASM_OPENRISC_FFS_H */ |