From: Ralf Baechle <ralf@linux-mips.org>
To: Juan Quintela <quintela@mandrakesoft.com>
Cc: mipslist <linux-mips@linux-mips.org>
Subject: Re: [PATCH]: test_bit returns int in all the architectures
Date: Fri, 20 Dec 2002 13:59:55 +0100 [thread overview]
Message-ID: <20021220135955.A31554@linux-mips.org> (raw)
In-Reply-To: <m2fzstgffx.fsf@demo.mitica>; from quintela@mandrakesoft.com on Fri, Dec 20, 2002 at 11:20:02AM +0100
On Fri, Dec 20, 2002 at 11:20:02AM +0100, Juan Quintela wrote:
> to be consistent with everybody else, test_bit should 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
diff -u -r1.21.2.9 bitops.h
--- include/asm-mips/bitops.h 5 Dec 2002 03:25:20 -0000 1.21.2.9
+++ include/asm-mips/bitops.h 20 Dec 2002 12:54:10 -0000
@@ -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
diff -u -r1.15.2.10 bitops.h
--- include/asm-mips64/bitops.h 5 Dec 2002 03:25:20 -0000 1.15.2.10
+++ include/asm-mips64/bitops.h 20 Dec 2002 12:54:12 -0000
@@ -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));
}
/*
prev parent reply other threads:[~2002-12-20 13:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-20 10:20 [PATCH]: test_bit returns int in all the architectures Juan Quintela
2002-12-20 12:59 ` Ralf Baechle [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021220135955.A31554@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=linux-mips@linux-mips.org \
--cc=quintela@mandrakesoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.