Path: blob/master/arch/unicore32/include/asm/bitops.h
10818 views
/*1* linux/arch/unicore32/include/asm/bitops.h2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*/1112#ifndef __UNICORE_BITOPS_H__13#define __UNICORE_BITOPS_H__1415#define find_next_bit __uc32_find_next_bit16#define find_next_zero_bit __uc32_find_next_zero_bit1718#define find_first_bit __uc32_find_first_bit19#define find_first_zero_bit __uc32_find_first_zero_bit2021#define _ASM_GENERIC_BITOPS_FLS_H_22#define _ASM_GENERIC_BITOPS___FLS_H_23#define _ASM_GENERIC_BITOPS_FFS_H_24#define _ASM_GENERIC_BITOPS___FFS_H_25/*26* On UNICORE, those functions can be implemented around27* the cntlz instruction for much better code efficiency.28*/2930static inline int fls(int x)31{32int ret;3334asm("cntlz\t%0, %1" : "=r" (ret) : "r" (x) : "cc");35ret = 32 - ret;3637return ret;38}3940#define __fls(x) (fls(x) - 1)41#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })42#define __ffs(x) (ffs(x) - 1)4344#include <asm-generic/bitops.h>4546#endif /* __UNICORE_BITOPS_H__ */474849