Click here to Skip to main content
15,912,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Favorites Icon using IWebBrowser2 control Pin
code-frog25-Apr-06 17:41
professionalcode-frog25-Apr-06 17:41 
GeneralRe: Favorites Icon using IWebBrowser2 control Pin
achimera25-Apr-06 18:05
achimera25-Apr-06 18:05 
GeneralRe: Favorites Icon using IWebBrowser2 control Pin
code-frog25-Apr-06 18:13
professionalcode-frog25-Apr-06 18:13 
GeneralRe: Favorites Icon using IWebBrowser2 control Pin
Russell Morris25-Apr-06 18:08
Russell Morris25-Apr-06 18:08 
GeneralRe: Favorites Icon using IWebBrowser2 control Pin
achimera25-Apr-06 18:13
achimera25-Apr-06 18:13 
AnswerRe: Favorites Icon using IWebBrowser2 control Pin
Mike Dimmick26-Apr-06 2:22
Mike Dimmick26-Apr-06 2:22 
GeneralRe: Favorites Icon using IWebBrowser2 control Pin
achimera26-Apr-06 9:44
achimera26-Apr-06 9:44 
Questionbit shifting Pin
Waldermort25-Apr-06 11:46
Waldermort25-Apr-06 11:46 
Hi all,

I'm reading 8 bytes from a byte array in order to create a double value. In order to do this I must fist read the bytes into an int64 then cast this to double. I'm having a little trouble shifting the array values into the correct position within the __int64.
__int64 *buf = new __int64;
// this is the result I want, but it only shifts 32 bits??
*buf = (((((((data[6] | data[7] << 8) | data[8] << 16 ) | data[9] << 24 ) | data[10] << 32 ) | data[11] << 40 ) | data[12] << 48 ) | data[13] << 56 );
// these two produce the exact same result
__int64 foo = ((data[10] | data[11] << 8) | data[12] << 16 ) | data[13] << 24;
__int64 bar = (((data[10] << 32) | data[11] << 40) | data[12] << 48 ) | data[13] << 56;
// this corrects the error
*foo <<= 32;
// cast the value
double* dub = (double *)buf;
double val = *dub;

As you can see from my code I am unable to read all 8 bytes in one line. The bytes only fill the first 32 bits. So when the values are read into *buf, the first 4 bytes goto the correct position then the next 4 bytes overwrite them. Why is this? If I read the first 4, then shift them 32 bits, then read the next 4 I can correctly read them. But why can't I read them in 1 line of code?
AnswerRe: bit shifting Pin
Michael Dunn25-Apr-06 12:58
sitebuilderMichael Dunn25-Apr-06 12:58 
GeneralRe: bit shifting Pin
Waldermort25-Apr-06 19:51
Waldermort25-Apr-06 19:51 
GeneralRe: bit shifting Pin
Michael Dunn25-Apr-06 20:41
sitebuilderMichael Dunn25-Apr-06 20:41 
GeneralRe: bit shifting Pin
Waldermort25-Apr-06 20:43
Waldermort25-Apr-06 20:43 
AnswerRe: bit shifting Pin
Bob Flynn26-Apr-06 2:38
Bob Flynn26-Apr-06 2:38 
QuestionHTTP Server Pin
Harshabhi25-Apr-06 10:00
Harshabhi25-Apr-06 10:00 
QuestionDoes VC++ 2003 produce better code than VC++ 2005 ? Pin
Defenestration25-Apr-06 9:58
Defenestration25-Apr-06 9:58 
AnswerRe: Does VC++ 2003 produce better code than VC++ 2005 ? Pin
Steve Maier25-Apr-06 10:57
professionalSteve Maier25-Apr-06 10:57 
QuestionCartesian Inheritance Pin
etm12425-Apr-06 9:14
etm12425-Apr-06 9:14 
AnswerRe: Cartesian Inheritance Pin
Ravi Bhavnani25-Apr-06 9:42
professionalRavi Bhavnani25-Apr-06 9:42 
GeneralRe: Cartesian Inheritance Pin
etm12425-Apr-06 9:46
etm12425-Apr-06 9:46 
GeneralRe: Cartesian Inheritance Pin
Ravi Bhavnani25-Apr-06 9:50
professionalRavi Bhavnani25-Apr-06 9:50 
GeneralRe: Cartesian Inheritance Pin
etm12425-Apr-06 9:54
etm12425-Apr-06 9:54 
GeneralRe: Cartesian Inheritance Pin
etm12425-Apr-06 9:58
etm12425-Apr-06 9:58 
AnswerRe: Cartesian Inheritance Pin
Ryan Binns25-Apr-06 16:07
Ryan Binns25-Apr-06 16:07 
QuestionOffice 12 new cool style look and feel Pin
Alex_Y25-Apr-06 9:13
Alex_Y25-Apr-06 9:13 
AnswerRe: Office 12 new cool style look and feel Pin
Joe Woodbury25-Apr-06 9:16
professionalJoe Woodbury25-Apr-06 9:16 

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.