summaryrefslogtreecommitdiffstats
path: root/include/asm-mips64/bitops.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-05-14 17:48:32 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-05-14 17:48:32 +0000
commitd4ee7ee5af14b99d6f9b70d3f806cc4a199a018a (patch)
treea3e4902fe44b36a66cd9d83d3acceb76a0c20dad /include/asm-mips64/bitops.h
parent0dbda7c681af1b63fb277f0e4634c7b5908fc951 (diff)
Fix __test_and{set,clear}_bit.
Diffstat (limited to 'include/asm-mips64/bitops.h')
-rw-r--r--include/asm-mips64/bitops.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/include/asm-mips64/bitops.h b/include/asm-mips64/bitops.h
index 179eff6f9..06b7870d7 100644
--- a/include/asm-mips64/bitops.h
+++ b/include/asm-mips64/bitops.h
@@ -107,14 +107,15 @@ test_and_set_bit(unsigned long nr, volatile void *addr)
return res != 0;
}
-extern __inline__ int __test_and_set_bit(int nr, volatile void * addr)
+extern __inline__ int
+__test_and_set_bit(int nr, volatile void * addr)
{
- int mask, retval;
- volatile long *a = addr;
+ unsigned long mask, retval;
+ long *a = (unsigned long *) addr;
- a += nr >> 6;
- mask = 1 << (nr & 0x3f);
- retval = (mask & *a) != 0;
+ a += (nr >> 6);
+ mask = 1UL << (nr & 0x3f);
+ retval = ((mask & *a) != 0);
*a |= mask;
return retval;
@@ -142,14 +143,15 @@ test_and_clear_bit(unsigned long nr, volatile void *addr)
return res != 0;
}
-extern __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
+extern __inline__ int
+__test_and_clear_bit(int nr, volatile void * addr)
{
- int mask, retval;
- volatile long *a = addr;
+ unsigned long mask, retval;
+ unsigned long *a = (unsigned long *) addr;
- a += nr >> 6;
- mask = 1 << (nr & 0x3f);
- retval = (mask & *a) != 0;
+ a += (nr >> 6);
+ mask = 1UL << (nr & 0x3f);
+ retval = ((mask & *a) != 0);
*a &= ~mask;
return retval;
@@ -179,7 +181,7 @@ test_and_change_bit(unsigned long nr, volatile void *addr)
extern __inline__ unsigned long
test_bit(int nr, volatile void * addr)
{
- return 1UL & (((const long *) addr)[nr >> 6] >> (nr & 0x3f));
+ return 1UL & (((volatile unsigned long *) addr)[nr >> 6] >> (nr & 0x3f));
}
#ifndef __MIPSEB__