Click here to Skip to main content
15,908,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: bit manupolation Pin
Michael Schubert7-Jun-08 3:35
Michael Schubert7-Jun-08 3:35 
AnswerRe: bit manupolation Pin
MahaKh7-Jun-08 4:07
MahaKh7-Jun-08 4:07 
GeneralRe: bit manupolation Pin
Michael Schubert7-Jun-08 4:10
Michael Schubert7-Jun-08 4:10 
GeneralRe: bit manupolation Pin
MahaKh7-Jun-08 4:36
MahaKh7-Jun-08 4:36 
GeneralRe: bit manupolation Pin
CPallini7-Jun-08 4:58
mveCPallini7-Jun-08 4:58 
AnswerRe: bit manupolation Pin
rp_suman7-Jun-08 5:44
rp_suman7-Jun-08 5:44 
GeneralRe: bit manupolation Pin
MahaKh7-Jun-08 10:37
MahaKh7-Jun-08 10:37 
AnswerRe: bit manupolation Pin
Chris Losinger7-Jun-08 5:45
professionalChris Losinger7-Jun-08 5:45 
the algorithm for this is very short: basically, four operations in a loop.

some key points to think about:

if the binary representation of the two numbers you are adding do not have any 1 bits in common, addition is equivalent to a simple OR. 0x01 | 0x02 = 0x03, 0x08 | 0x03 = 0x0b (8 + 3 = 11 = 1000b + 0011b = 1011b). but, such a situation is the exception.

so, what do you do when numbers share bits?

(1 + 1 = 2)
0001b
0001b +
----------
0010b

(3 + 3 = 6)
0011b
0011b +
----------
0110b

(9 + 3 = 12)
1001b
0011b +
----------
1100b

see the pattern ?

1 + 1 = 2 but there is no 2 in base2, so put a zero, carry the one to the next column and do it again.


QuestionClearing client window Pin
Kwanalouie7-Jun-08 2:15
Kwanalouie7-Jun-08 2:15 
AnswerRe: Clearing client window Pin
Nelek7-Jun-08 2:19
protectorNelek7-Jun-08 2:19 
GeneralRe: Clearing client window Pin
Kwanalouie7-Jun-08 3:15
Kwanalouie7-Jun-08 3:15 
GeneralRe: Clearing client window Pin
Nelek7-Jun-08 3:23
protectorNelek7-Jun-08 3:23 
AnswerRe: Clearing client window Pin
Ravi Bhavnani7-Jun-08 11:27
professionalRavi Bhavnani7-Jun-08 11:27 
QuestionIs it possible to create C++ obj in C with new operator? Pin
Nandu_77b7-Jun-08 0:52
Nandu_77b7-Jun-08 0:52 
AnswerRe: Is it possible to create C++ obj in C with new operator? Pin
Gary R. Wheeler7-Jun-08 0:58
Gary R. Wheeler7-Jun-08 0:58 
QuestionRe: Is it possible to create C++ obj in C with new operator? Pin
Nandu_77b7-Jun-08 1:22
Nandu_77b7-Jun-08 1:22 
AnswerRe: Is it possible to create C++ obj in C with new operator? Pin
Gary R. Wheeler7-Jun-08 2:52
Gary R. Wheeler7-Jun-08 2:52 
GeneralRe: Is it possible to create C++ obj in C with new operator? Pin
Nandu_77b7-Jun-08 3:22
Nandu_77b7-Jun-08 3:22 
QuestionEsc Button use for Close the Dialog Box. Pin
Le@rner7-Jun-08 0:41
Le@rner7-Jun-08 0:41 
AnswerRe: Esc Button use for Close the Dialog Box. Pin
Gary R. Wheeler7-Jun-08 1:05
Gary R. Wheeler7-Jun-08 1:05 
GeneralRe: Esc Button use for Close the Dialog Box. Pin
Nelek7-Jun-08 2:13
protectorNelek7-Jun-08 2:13 
GeneralRe: Esc Button use for Close the Dialog Box. Pin
Gary R. Wheeler7-Jun-08 2:18
Gary R. Wheeler7-Jun-08 2:18 
GeneralRe: Esc Button use for Close the Dialog Box. Pin
Nelek7-Jun-08 2:22
protectorNelek7-Jun-08 2:22 
GeneralRe: Esc Button use for Close the Dialog Box. Pin
Rajesh R Subramanian7-Jun-08 6:16
professionalRajesh R Subramanian7-Jun-08 6:16 
AnswerRe: Esc Button use for Close the Dialog Box. Pin
Nelek7-Jun-08 2:11
protectorNelek7-Jun-08 2:11 

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.