]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - arch/unicore32/include/asm/bitops.h
fls: change parameter to unsigned int
[mirror_ubuntu-eoan-kernel.git] / arch / unicore32 / include / asm / bitops.h
CommitLineData
96cf5185
G
1/*
2 * linux/arch/unicore32/include/asm/bitops.h
3 *
4 * Code specific to PKUnity SoC and UniCore ISA
5 *
6 * Copyright (C) 2001-2010 GUAN Xue-tao
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __UNICORE_BITOPS_H__
14#define __UNICORE_BITOPS_H__
15
96cf5185
G
16#define _ASM_GENERIC_BITOPS_FLS_H_
17#define _ASM_GENERIC_BITOPS___FLS_H_
18#define _ASM_GENERIC_BITOPS_FFS_H_
19#define _ASM_GENERIC_BITOPS___FFS_H_
20/*
21 * On UNICORE, those functions can be implemented around
22 * the cntlz instruction for much better code efficiency.
23 */
24
3fc2579e 25static inline int fls(unsigned int x)
96cf5185
G
26{
27 int ret;
28
29 asm("cntlz\t%0, %1" : "=r" (ret) : "r" (x) : "cc");
30 ret = 32 - ret;
31
32 return ret;
33}
34
35#define __fls(x) (fls(x) - 1)
36#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
37#define __ffs(x) (ffs(x) - 1)
38
39#include <asm-generic/bitops.h>
40
e13b91c1
GX
41/* following definitions: to avoid using codes in lib/find_*.c */
42#define find_next_bit find_next_bit
43#define find_next_zero_bit find_next_zero_bit
44#define find_first_bit find_first_bit
45#define find_first_zero_bit find_first_zero_bit
46
0ade34c3
CC
47#include <asm-generic/bitops/find.h>
48
96cf5185 49#endif /* __UNICORE_BITOPS_H__ */