root/arch/csky/include/asm/bitops.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ffs
  2. __ffs
  3. fls
  4. __fls

   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
   3 
   4 #ifndef __ASM_CSKY_BITOPS_H
   5 #define __ASM_CSKY_BITOPS_H
   6 
   7 #include <linux/compiler.h>
   8 #include <asm/barrier.h>
   9 
  10 /*
  11  * asm-generic/bitops/ffs.h
  12  */
  13 static inline int ffs(int x)
  14 {
  15         if (!x)
  16                 return 0;
  17 
  18         asm volatile (
  19                 "brev %0\n"
  20                 "ff1  %0\n"
  21                 "addi %0, 1\n"
  22                 : "=&r"(x)
  23                 : "0"(x));
  24         return x;
  25 }
  26 
  27 /*
  28  * asm-generic/bitops/__ffs.h
  29  */
  30 static __always_inline unsigned long __ffs(unsigned long x)
  31 {
  32         asm volatile (
  33                 "brev %0\n"
  34                 "ff1  %0\n"
  35                 : "=&r"(x)
  36                 : "0"(x));
  37         return x;
  38 }
  39 
  40 /*
  41  * asm-generic/bitops/fls.h
  42  */
  43 static __always_inline int fls(unsigned int x)
  44 {
  45         asm volatile(
  46                 "ff1 %0\n"
  47                 : "=&r"(x)
  48                 : "0"(x));
  49 
  50         return (32 - x);
  51 }
  52 
  53 /*
  54  * asm-generic/bitops/__fls.h
  55  */
  56 static __always_inline unsigned long __fls(unsigned long x)
  57 {
  58         return fls(x) - 1;
  59 }
  60 
  61 #include <asm-generic/bitops/ffz.h>
  62 #include <asm-generic/bitops/fls64.h>
  63 #include <asm-generic/bitops/find.h>
  64 
  65 #ifndef _LINUX_BITOPS_H
  66 #error only <linux/bitops.h> can be included directly
  67 #endif
  68 
  69 #include <asm-generic/bitops/sched.h>
  70 #include <asm-generic/bitops/hweight.h>
  71 #include <asm-generic/bitops/lock.h>
  72 #include <asm-generic/bitops/atomic.h>
  73 
  74 /*
  75  * bug fix, why only could use atomic!!!!
  76  */
  77 #include <asm-generic/bitops/non-atomic.h>
  78 #define __clear_bit(nr, vaddr) clear_bit(nr, vaddr)
  79 
  80 #include <asm-generic/bitops/le.h>
  81 #include <asm-generic/bitops/ext2-atomic.h>
  82 #endif /* __ASM_CSKY_BITOPS_H */

/* [<][>][^][v][top][bottom][index][help] */