Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

warning C4311: 'type cast' : pointer truncation

Avatar of ksmathy
ksmathy asked on
Editors IDEs
5 Comments1 Solution1725 ViewsLast Modified:
I have tried to write method which take two 16 bits as input and return on 32 bits number.    
I have an warning msg (pointer truncation)in following method.
This warning messge can be ignored or cause the problems
UInt32 getInt32FromInt16(UInt16 MSW,UInt16 LSW)
   UInt32 *pInt[4];
   return ((UInt32)*pInt);
but the below method does not give error msg
UInt64 getInt64FromInt32(UInt32 MSW,UInt32 LSW)
   UInt64 *pInt[8];
   return ((UInt64)*pInt);

is there any other methods which coverts two 16 (or 32)bits into one 32(or 64) bit

In reverse, I also write the method which take large number(32bits) as an input and put it into two 16 bits buffer
void setInt32FromInt16(UInt16& MSW,UInt16& LSW,UInt32 anInteger)
  char * pCharBuffer = (char*)&anInteger;
   UInt16 * pLSW = (UInt16*)&pCharBuffer[0];
   UInt16 * pMSW = (UInt16*)&pCharBuffer[2];
   MSW=* pMSW ;
   LSW=* pLSW ;
I just wondering, this method is ok or not
could you please help me out

Avatar of George Tokas
George TokasFlag of Greece image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers