: test_bit returns int in all the architectures
PATCH 1/1 : test_bit returns int in all the architectures
Hi
to be consistent with everybody else, test_bit should return a int. Notice that it only returns 0/1, not a big deal.
Later, Juan.
Index: include/asm-mips64/bitops.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips64/bitops.h,v retrieving revision 1.15.2.10
asm-mips64/bitops.h +1 -1
@@ -302,7 +302,7 @@* @nr: bit number to test * @addr: Address to start counting from */ -static inline unsigned long test_bit (int nr,volatile void * addr) +static inline unsigned int test_bit (int nr,volatile void * addr) {return 1UL & (((volatile unsigned long *) addr)[nr >>6 ] >> (nr &0x3f )); }
Signature · 2 lines
In theory, practice and theory are the same, but in practice they are different -- Larry McVoy
Quoted 2 lines · Juan Quintela
to be consistent with everybody else,
test_bitshould return a int. Notice that it only returns 0/1, not a big deal.
I'm using below patch instead.
Ralf
Index: include/asm-mips/bitops.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/bitops.h,v retrieving revision 1.21.2.9
asm-mips/bitops.h +2 -2
@@ -582,9 +582,9 @@* @nr: bit number to test * @addr: Address to start counting from */ -static __inline__int test_bit (int nr,volatile void *addr) +static inline int test_bit (int nr,volatile void *addr) { -return ((1UL << (nr &31 )) & (((const unsigned int *) addr)[nr >>5 ])) !=0 ; +return 1UL & (((const volatile unsigned long *) addr)[nr >>SZLONG_LOG ] >> (nr &SZLONG_MASK )); }/*
Index: include/asm-mips64/bitops.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips64/bitops.h,v retrieving revision 1.15.2.10
asm-mips64/bitops.h +2 -2
@@ -302,9 +302,9 @@* @nr: bit number to test * @addr: Address to start counting from */ -static inline unsigned long test_bit (int nr,volatile void * addr) +static inline int test_bit (int nr,volatile void * addr) { -return 1UL & (((volatile unsigned long *) addr)[nr >>6 ] >> (nr &0x3f )); +return 1UL & (((const volatile unsigned long *) addr)[nr >>SZLONG_LOG ] >> (nr &SZLONG_MASK )); }/*