Click here to Skip to main content
15,916,379 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Finding the dimensions of a PNG File Pin
David Crow8-May-03 4:58
David Crow8-May-03 4:58 
GeneralRe: Finding the dimensions of a PNG File Pin
Real World8-May-03 7:24
Real World8-May-03 7:24 
GeneralRe: Finding the dimensions of a PNG File Pin
David Crow8-May-03 7:33
David Crow8-May-03 7:33 
GeneralRe: Finding the dimensions of a PNG File Pin
Real World8-May-03 7:40
Real World8-May-03 7:40 
GeneralRe: Finding the dimensions of a PNG File Pin
Real World8-May-03 7:56
Real World8-May-03 7:56 
GeneralRe: Finding the dimensions of a PNG File Pin
David Crow8-May-03 9:09
David Crow8-May-03 9:09 
GeneralRe: Finding the dimensions of a PNG File Pin
David Crow8-May-03 10:22
David Crow8-May-03 10:22 
GeneralI hate __int64! Pin
Simon Steele8-May-03 3:43
Simon Steele8-May-03 3:43 
Hi,

I'm having a frustrating little problem with 64-bit integer arithmetic. It goes something like this:

0xba5da800 * 0x38E

which should equal:

0x29678EB3000

Unfortunately, the code is a bit like this:

#define unsigned __int64 uint64_t<br />
<br />
unsigned long myval = 0xba5e3500;<br />
<br />
uint64_t myfunction(unsigned long val)<br />
{<br />
    return val * 1000;<br />
}


This doesn't work, nor does:

return ((uint64_t)val * (uint64_t)1000);
or
return (uint64_t)((uint64_t)val * (uint64_t)1000);

The value I get returned looks like:

0xfffffeefffff0800 (or similar)

Now, I've run into problems before with not casting everything into __int64 twice (ok I exadurate slightly) for every calculation - but this is weird. It seems that casting val to uint64_t is turning it into:

0xffffffffba5e3500

Why is this happening?!

I truly do hate __int64, any help would be appreciated.

thanks,

Simon

--
Simon Steele
Programmers Notepad - http://www.pnotepad.org/
GeneralRe: I hate __int64! Pin
David Crow8-May-03 4:08
David Crow8-May-03 4:08 
GeneralRe: I hate __int64! Pin
Len Holgate8-May-03 4:26
Len Holgate8-May-03 4:26 
GeneralRe: I hate __int64! Pin
Simon Steele8-May-03 4:41
Simon Steele8-May-03 4:41 
Generalfile properties Pin
urid8-May-03 3:32
urid8-May-03 3:32 
GeneralRe: file properties Pin
JensB8-May-03 3:44
JensB8-May-03 3:44 
GeneralRe: file properties Pin
David Crow8-May-03 4:10
David Crow8-May-03 4:10 
GeneralRe: file properties Pin
urid8-May-03 4:24
urid8-May-03 4:24 
GeneralRe: file properties Pin
David Crow8-May-03 3:52
David Crow8-May-03 3:52 
GeneralRe: file properties Pin
urid8-May-03 4:15
urid8-May-03 4:15 
GeneralRe: file properties Pin
David Crow8-May-03 4:43
David Crow8-May-03 4:43 
Generalcenter text in title bar of app. Pin
JensB8-May-03 3:04
JensB8-May-03 3:04 
GeneralRe: center text in title bar of app. Pin
David Crow8-May-03 4:25
David Crow8-May-03 4:25 
GeneralRe: center text in title bar of app. Pin
JensB8-May-03 4:30
JensB8-May-03 4:30 
GeneralRe: center text in title bar of app. Pin
Renjith Ramachandran8-May-03 5:14
Renjith Ramachandran8-May-03 5:14 
GeneralRe: center text in title bar of app. Pin
User 66588-May-03 6:17
User 66588-May-03 6:17 
GeneralRe: center text in title bar of app. Pin
Joan M8-May-03 5:57
professionalJoan M8-May-03 5:57 
GeneralRe: center text in title bar of app. Pin
Hari Krishnan (Noida)8-May-03 6:14
Hari Krishnan (Noida)8-May-03 6:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.