linux - convert ushort to long in 64 bit architecture in c++ -


i porting code 32bit unix 64 bit linux machine.
if have variable in const long l1 , variable in ushort us1. need compare these 2 if( l1 != us1) .... not working. typecasting should use ?. piece worked in 32 bit unix works unpredictably in linux 64 bit. works correctly , doesn't. reason number of bits occupied long changed now. planning convert us1(ushort) ulong , compare. (l1 != (ulong)us1). again in l1 still signed.
please suggest should appropriate type conversions. code snippet below:

nise::facex::order::niseworkorder *wrkord = 0;  (this ushort)   int retcode = getniseorder(wrkord, asyncq->m_order_number);      (niseworkorder function wrkord reference pointer).   

getniseorder croba call , populate niseworkorder structure).
now,
asyncq->m_version_num osplong.
traceprt(app_lvl, ("wrkord->orderhead.wrkordkey.order.orderversion = <%d>",wrkord->orderhead.wrkordkey.order.orderversion));
traceprt(app_lvl, ("(const long)asyncq->m_version_num = <%d>", (const long)asyncq->m_version_num));
(const long)asyncq->m_version_num != wrkord->orderhead.wrkordkey.order.orderversion)
{......}

issue although traces show both values same still if condition true(which should not be).


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -