[openib-general] [PATCH][MINOR] OpenSM: Simplify some endian conversions in osm_prtn.c and osm_pkey_mgr.c

Hal Rosenstock halr at voltaire.com
Wed Jul 19 06:51:10 PDT 2006


OpenSM: Simplify some endian conversions in osm_prtn.c and
osm_pkey_mgr.c

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: opensm/osm_prtn.c
===================================================================
--- opensm/osm_prtn.c	(revision 8586)
+++ opensm/osm_prtn.c	(working copy)
@@ -208,7 +208,7 @@ ib_api_status_t osm_prtn_add_mcgroup(osm
 	osm_sa_t *p_sa = &p_subn->p_osm->sa;
 	ib_api_status_t status = IB_SUCCESS;
 
-	pkey = cl_hton16(cl_ntoh16(p->pkey) | 0x8000);
+	pkey = p->pkey | cl_hton16(0x8000);
 
 	memset(&mc_rec, 0, sizeof(mc_rec));
 
@@ -272,7 +272,7 @@ osm_prtn_t *osm_prtn_make_new(osm_log_t 
 		return NULL;
 
 	if (cl_ntoh16(pkey) & 0x8000) {
-		pkey = cl_hton16(cl_ntoh16(pkey) & ~0x8000);
+		pkey &= cl_hton16(~0x8000);
 		osm_log(p_log, OSM_LOG_VERBOSE,
 			"osm_prtn_make_new: pkey stripped for"
 			" partition \'%s\' (0x%04x)\n",
Index: opensm/osm_pkey_mgr.c
===================================================================
--- opensm/osm_pkey_mgr.c	(revision 8586)
+++ opensm/osm_pkey_mgr.c	(working copy)
@@ -172,7 +172,7 @@ pkey_mgr_process_partition_table(
   osm_physp_t *p_physp;
 
   if (full)
-    pkey = cl_hton16( cl_ntoh16( pkey ) | 0x8000 );
+    pkey |= cl_hton16( 0x8000 );
 
   i_next = cl_map_head( p_tbl );
   while ( i_next != cl_map_end( p_tbl ) )







More information about the general mailing list