Click here to Skip to main content
15,915,328 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: matrix x vector -> vector Pin
enhzflep9-Jun-10 17:42
enhzflep9-Jun-10 17:42 
GeneralRe: matrix x vector -> vector Pin
VeganFanatic9-Jun-10 17:45
VeganFanatic9-Jun-10 17:45 
AnswerRe: matrix x vector -> vector Pin
CPallini9-Jun-10 20:56
mveCPallini9-Jun-10 20:56 
QuestionDisable shortcuts of CRichEdit control. Pin
ShilpiP9-Jun-10 7:09
ShilpiP9-Jun-10 7:09 
AnswerRe: Disable shortcuts of CRichEdit control. Pin
Rajesh R Subramanian9-Jun-10 7:18
professionalRajesh R Subramanian9-Jun-10 7:18 
QuestionOperator Or Pin
Schehaider_Aymen9-Jun-10 4:19
Schehaider_Aymen9-Jun-10 4:19 
AnswerRe: Operator Or Pin
Chris Losinger9-Jun-10 4:21
professionalChris Losinger9-Jun-10 4:21 
AnswerRe: Operator Or Pin
Aescleal9-Jun-10 4:33
Aescleal9-Jun-10 4:33 
Being slightly cynical addition sounds like the operator you neeed... With your statements val is going to end up containing 1004 as there's a large overlap in the bits set between the bit pattern for 1000 (1111101000b) and the bit pattern for 100 (1100100b).

If you're trying to fiddle individual bits (i.e. turn bits with OR 1, turn them off with AND 0) then perhaps encode your numbers as powers of two and/or use hex:

if( a == 5 )
    val |= 0x1000;

if( b == 20 )
    val |= 0x100;


Cheers,

Ash

PS: Another way of setting and resetting individual bits is to use bit fields. Perhaps they might be more in tune with what you want?
GeneralRe: Operator Or, Pin
Schehaider_Aymen9-Jun-10 4:51
Schehaider_Aymen9-Jun-10 4:51 
GeneralRe: Operator Or, Pin
David Crow9-Jun-10 5:05
David Crow9-Jun-10 5:05 
GeneralRe: Operator Or Pin
Aescleal9-Jun-10 5:05
Aescleal9-Jun-10 5:05 
GeneralRe: Operator Or Pin
Schehaider_Aymen9-Jun-10 5:12
Schehaider_Aymen9-Jun-10 5:12 
GeneralRe: Operator Or Pin
Niklas L9-Jun-10 8:00
Niklas L9-Jun-10 8:00 
GeneralRe: Operator Or [modified] Pin
Aescleal9-Jun-10 8:06
Aescleal9-Jun-10 8:06 
GeneralRe: Operator Or Pin
Schehaider_Aymen9-Jun-10 21:47
Schehaider_Aymen9-Jun-10 21:47 
GeneralRe: Operator Or Pin
Schehaider_Aymen9-Jun-10 5:00
Schehaider_Aymen9-Jun-10 5:00 
QuestionStart service Before Login Pin
gothic_coder9-Jun-10 1:46
gothic_coder9-Jun-10 1:46 
AnswerRe: Start service Before Login Pin
«_Superman_»9-Jun-10 2:01
professional«_Superman_»9-Jun-10 2:01 
GeneralRe: Start service Before Login Pin
gothic_coder9-Jun-10 2:16
gothic_coder9-Jun-10 2:16 
GeneralRe: Start service Before Login Pin
«_Superman_»9-Jun-10 19:08
professional«_Superman_»9-Jun-10 19:08 
GeneralRe: Start service Before Login Pin
gothic_coder10-Jun-10 21:19
gothic_coder10-Jun-10 21:19 
QuestionScanning IE8 memory. Pin
Evgeni579-Jun-10 1:09
Evgeni579-Jun-10 1:09 
AnswerRe: Scanning IE8 memory. Pin
Richard Andrew x649-Jun-10 4:43
professionalRichard Andrew x649-Jun-10 4:43 
AnswerRe: Scanning IE8 memory. Pin
Stephen Hewitt9-Jun-10 14:08
Stephen Hewitt9-Jun-10 14:08 
QuestionDeleting a file to the recycle bin using SHFileOperation Pin
elie0029-Jun-10 0:38
elie0029-Jun-10 0:38 

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.