[openib-general] Opensm - casting issues #2

Yael Kalka eitan at mtl001.openib.org
Tue Sep 13 02:08:10 PDT 2005


Hi Hal,

Attached is a patch to fix some casting issues in ib_types.h.
In Linux it compiles fine, but under Windows I get compilation errors due to the problem.

Thanks,
Yael

Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: ib_types.h
===================================================================
--- ib_types.h  (revision 3395)
+++ ib_types.h  (working copy)
@@ -5669,7 +5669,7 @@ ib_member_get_sl_flow_hop(
        tmp_sl_flow_hop = tmp_sl_flow_hop >> 20;
 
        if (p_hop)
-               *p_hop = tmp_sl_flow_hop & 0xff;
+               *p_hop = (uint8_t)(tmp_sl_flow_hop & 0xff);
 }
 /*
 * PARAMETERS
@@ -6083,7 +6083,7 @@ ib_notice_set_prod_type(
   IN ib_net32_t prod_type_val)
 {
   uint32_t ptv = cl_ntoh32(prod_type_val);
-  p_ntc->g_or_v.generic.prod_type_lsb = cl_hton16( ptv & 0x0000ffff);
+  p_ntc->g_or_v.generic.prod_type_lsb = cl_hton16((uint16_t)(ptv & 0x0000ffff));
   p_ntc->g_or_v.generic.prod_type_msb = (uint8_t)( (ptv & 0x00ff0000) >> 16);
 }
 /*
@@ -6146,7 +6146,7 @@ ib_notice_set_vend_id(
   IN ib_net32_t vend_id)
 {
   uint32_t vi = cl_ntoh32(vend_id);
-  p_ntc->g_or_v.vend.vend_id_lsb = cl_hton16(vi & 0x0000ffff);
+  p_ntc->g_or_v.vend.vend_id_lsb = cl_hton16((uint16_t)(vi & 0x0000ffff));
   p_ntc->g_or_v.vend.vend_id_msb = (uint8_t)((vi & 0x00ff0000) >> 16);
 }
 /*




More information about the general mailing list