Is there a macro which converts a 32 bit signed integer to 64 bit unsigned integer ?
Is there a macro which converts a 32 bit signed integer to 64 bit unsigned integer ?
Hello All,
Is there a macro which converts a 32 bit signed integer to 64 bit unsigned integer
Thanks in Advance,
CPPUser7
Is there a macro which converts a 32 bit signed integer to 64 bit unsigned integer ?
MaciekWojcik
Anarchy
Thanks a lot for you responses
TedSA
Thomas Werner
To get to the bottom of this, it would help to be be compiling the same code with the same version of Visual Studio.
Try this (I have VS 2005):
#include <windows.h>
int
main(){
long i1 = -1;
ULONGLONG i2 = i1;
printf("%I64x\n",i2);
}
calmal20
1. C:\program files\microsoft visual studio.net\VC7\platformsdk\include\oledb.h
Here ULONGLONG is defined as
typedef MIDL_uhyper ULONGLONG;
and in rpcndr.h MIDL_uhyper is defined as
#define MIDL_uhyper unsigned __int64
2. C:\program files\microsoft visual studio.net\VC7\platformsdk\include\winnt.h
typedef unsigned __int64 ULONGLONG;
3. C:\program files\microsoft visual studio.net\VC7\platformsdk\include\wtypes.h
typedef unsigned __int64 ULONGLONG;
I am running Microsoft Visual C++ .NET on Microsoft Development Environment 2002 Version 7.0.9955 and
Microsoft .NET Framework 1.0 version 1.0.3705
Please let me know if you needed more information. Thanks for your time.
Chrisull
long i1 = -1;
ULONGLONG i2 = i1;
Why do you need a macro
lee_70
ULONGLONG should be a typedef:
typedef unsigned __int64 ULONGLONG;
Try using "right click: Go to definition" on ULONGLONG to see if it is any different.
paso
Big5824
long func() {
return -1;
}
int _tmain(int argc, _TCHAR* argv[])
{
ULONGLONG i = 0;
i += func();
}
Still no warning. It would, like, really, really help if we could see your code. I mean, really...
skuehner
Thanks for your response. But I am looking for some Win API macro if exists which does this job. My requirement is to convert a long to ULONGLONG.
Any pointers will be appreciated.
sowjanya
&#24859;&#38738;&#34521;
I am getting the following warning upon building
"warning C4244: '+=' : conversion from 'long' to 'ULONGLONG', possible loss of data"
I wanted a solution without any warnings.
I thought, I could zero off the High bit(which holds the sign) in the 32 bit signed integer and get an unsigned 32 bit and then assign this to 64 bit unsigned integer. Something like this
long l = 3;
ULONG ul = l & 0x7FFFFFFF;
ULONGLONG ull = ul;
But still I am not convinced as this works on application running on 32 bit system(which I am currently working on) but not sure if the same code will work for application running on 64 bit system. So, looking if Win API provides any such macro to do the job.
renealejandrov
int i1 = -1;
unsigned __int64 i2 = i1;
System::Int32 i3 = -1;
System::Int64 i4 = i3;
Jon Braganza