1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Bitops taken from the kernel as most developers are already used 4 * to them. 5 * 6 * Copyright IBM Corp. 1999,2013 7 * 8 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>, 9 * 10 */ 11 #ifndef _ASMS390X_BITOPS_H_ 12 #define _ASMS390X_BITOPS_H_ 13 14 #ifndef _BITOPS_H_ 15 #error only <bitops.h> can be included directly 16 #endif 17 18 #define BITS_PER_LONG 64 19 test_bit(unsigned long nr,const volatile unsigned long * ptr)20static inline bool test_bit(unsigned long nr, 21 const volatile unsigned long *ptr) 22 { 23 const volatile unsigned char *addr; 24 25 addr = ((const volatile unsigned char *)ptr); 26 addr += (nr ^ (BITS_PER_LONG - 8)) >> 3; 27 return (*addr >> (nr & 7)) & 1; 28 } 29 test_bit_inv(unsigned long nr,const volatile unsigned long * ptr)30static inline bool test_bit_inv(unsigned long nr, 31 const volatile unsigned long *ptr) 32 { 33 return test_bit(nr ^ (BITS_PER_LONG - 1), ptr); 34 } 35 36 #endif 37