Click here to Skip to main content
15,905,322 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to inverse a variable in bit level? Pin
Randor 8-Jan-09 23:05
professional Randor 8-Jan-09 23:05 
GeneralRe: How to inverse a variable in bit level? Pin
toxcct8-Jan-09 23:49
toxcct8-Jan-09 23:49 
GeneralRe: How to inverse a variable in bit level? Pin
Randor 8-Jan-09 23:55
professional Randor 8-Jan-09 23:55 
GeneralRe: How to inverse a variable in bit level? Pin
toxcct9-Jan-09 0:00
toxcct9-Jan-09 0:00 
GeneralRe: How to inverse a variable in bit level? Pin
Randor 9-Jan-09 0:09
professional Randor 9-Jan-09 0:09 
GeneralRe: How to inverse a variable in bit level? Pin
toxcct10-Jan-09 22:57
toxcct10-Jan-09 22:57 
AnswerRe: A plain approach Pin
CPallini8-Jan-09 22:44
mveCPallini8-Jan-09 22:44 
GeneralRe: A plain approach Pin
Iain Clarke, Warrior Programmer9-Jan-09 0:16
Iain Clarke, Warrior Programmer9-Jan-09 0:16 
I'm not sure it's much less efficient - all those multiplies will quite a high cost.

If it's just a BYTE, you could cut it down more by not even bothering with a loop:

BYTE b = 139;
BYTE r;
r = ((b & 1) << 7) | ((b & 2) << 5) | ((b & 4) << 3)  | ((b & 8) << 1)  | ((b & 16) >> 1)  | ((b & 32) >> 3)  | ((b & 64) << 5)  | ((b & 128) >> 7) )


This would not extend well for unsigned __int64...

Iain.

Codeproject MVP for C++, I can't believe it's for my lounge posts...

JokeRe: A plain approach Pin
CPallini9-Jan-09 0:28
mveCPallini9-Jan-09 0:28 
GeneralRe: A plain approach Pin
Randor 9-Jan-09 1:05
professional Randor 9-Jan-09 1:05 
GeneralRe: A plain approach Pin
CPallini9-Jan-09 1:43
mveCPallini9-Jan-09 1:43 
GeneralRe: How to inverse a variable in bit level? Pin
Luc Pattyn9-Jan-09 2:51
sitebuilderLuc Pattyn9-Jan-09 2:51 
QuestionPotential problem with 'typedef redefinition' Pin
6Qing888-Jan-09 20:27
6Qing888-Jan-09 20:27 
AnswerRe: Potential problem with 'typedef redefinition' Pin
sashoalm8-Jan-09 20:32
sashoalm8-Jan-09 20:32 
GeneralRe: Potential problem with 'typedef redefinition' Pin
6Qing888-Jan-09 20:40
6Qing888-Jan-09 20:40 
GeneralRe: Potential problem with 'typedef redefinition' Pin
sashoalm8-Jan-09 21:37
sashoalm8-Jan-09 21:37 
AnswerRe: Potential problem with 'typedef redefinition' Pin
Stuart Dootson8-Jan-09 21:45
professionalStuart Dootson8-Jan-09 21:45 
QuestionFont and size of default message Box Pin
tasumisra8-Jan-09 20:04
tasumisra8-Jan-09 20:04 
AnswerRe: Font and size of default message Box Pin
Randor 8-Jan-09 20:34
professional Randor 8-Jan-09 20:34 
QuestionLoad data in Combobox in VC++6.0 Pin
aa_zz8-Jan-09 19:12
aa_zz8-Jan-09 19:12 
AnswerRe: Load data in Combobox in VC++6.0 Pin
Hamid_RT8-Jan-09 19:20
Hamid_RT8-Jan-09 19:20 
GeneralRe: Load data in Combobox in VC++6.0 Pin
aa_zz8-Jan-09 19:24
aa_zz8-Jan-09 19:24 
GeneralRe: Load data in Combobox in VC++6.0 Pin
Hamid_RT8-Jan-09 19:31
Hamid_RT8-Jan-09 19:31 
AnswerRe: Load data in Combobox in VC++6.0 Pin
Chandrasekharan P8-Jan-09 19:25
Chandrasekharan P8-Jan-09 19:25 
GeneralRe: Load data in Combobox in VC++6.0 Pin
aa_zz8-Jan-09 19:38
aa_zz8-Jan-09 19: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.