[ofa-general] [PATCH] opensm/osm_vendor_ibumad: fix set_bit() func

Sasha Khapyorsky sashak at voltaire.com
Wed Oct 31 23:21:01 PDT 2007


This fixes set_bit() bitmask handling function for cases when
sizeof(long) != 4.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/libvendor/osm_vendor_ibumad.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/opensm/libvendor/osm_vendor_ibumad.c b/opensm/libvendor/osm_vendor_ibumad.c
index 6d78573..240a97b 100644
--- a/opensm/libvendor/osm_vendor_ibumad.c
+++ b/opensm/libvendor/osm_vendor_ibumad.c
@@ -782,11 +782,11 @@ static void osm_vendor_close_port(osm_vendor_t * const p_vend)
 
 static int set_bit(int nr, void *method_mask)
 {
-	int mask, retval;
-	long *addr = method_mask;
+	long mask, *addr = method_mask;
+	int retval;
 
-	addr += nr >> 5;
-	mask = 1 << (nr & 0x1f);
+	addr += nr / (8*sizeof(long));
+	mask = 1L << (nr % (8*sizeof(long)));
 	retval = (mask & *addr) != 0;
 	*addr |= mask;
 	return retval;
-- 
1.5.3.rc2.29.gc4640f




More information about the general mailing list