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

C / C++ / MFC

 
QuestionRe: random 12-bit unsinged int Pin
Johan Pretorius6-Jan-07 2:02
Johan Pretorius6-Jan-07 2:02 
AnswerRe: random 12-bit unsinged int Pin
ikbahrian6-Jan-07 2:12
ikbahrian6-Jan-07 2:12 
GeneralRe: random 12-bit unsinged int [modified] Pin
Johan Pretorius6-Jan-07 2:19
Johan Pretorius6-Jan-07 2:19 
GeneralRe: random 12-bit unsinged int Pin
ikbahrian6-Jan-07 2:40
ikbahrian6-Jan-07 2:40 
AnswerRe: random 12-bit unsinged int Pin
Johan Pretorius6-Jan-07 3:05
Johan Pretorius6-Jan-07 3:05 
GeneralRe: random 12-bit unsinged int Pin
ikbahrian6-Jan-07 3:14
ikbahrian6-Jan-07 3:14 
GeneralRe: random 12-bit unsinged int Pin
Johan Pretorius6-Jan-07 5:25
Johan Pretorius6-Jan-07 5:25 
GeneralRe: random 12-bit unsinged int Pin
Johan Pretorius6-Jan-07 5:44
Johan Pretorius6-Jan-07 5:44 
I am asuming that your 4bit value is also comming from and integer so ...
int total16 = (bit14 & 0xFFF) + ((bit4 & 0xF) << 12);

that should add your 2 values into one.
The & operator will mask the left value with the right.
example
int value = 151; //in binary = 10010111
//the mask we will be using will be 0xaa (170 dec) wich is 10101010 in binary
int value2 = value & 0xAA;
// this will do the mask
// value    10010111
// 0xAA     10101010 
// =        10000010
// so your answer is 10000010 wich is 130 in dec.
// so value2 == 130

// the shift operator << and >> shifts bits in an direction
// we are now going to shift the value of value2 right with one bit
value2 = value2 >> 1;
//this will do the shift as following
// value2   10000010
// >>  1
// answer   01000001 (65 in dec)


Hope this is what you needed Big Grin | :-D




Artificial Intelligence is no match for Natural Stupidity

No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir

I can't always be wrong ... or can I?


Questionhow to track a URL(website address) Pin
ShaluMalu6-Jan-07 1:22
ShaluMalu6-Jan-07 1:22 
AnswerRe: how to track a URL(website address) Pin
Monty26-Jan-07 1:28
Monty26-Jan-07 1:28 
AnswerRe: how to track a URL(website address) Pin
Hamid_RT6-Jan-07 17:23
Hamid_RT6-Jan-07 17:23 
QuestionHiden Button is Disabled !! Pin
dharani6-Jan-07 0:44
dharani6-Jan-07 0:44 
AnswerRe: Hiden Button is Disabled !! Pin
Monty26-Jan-07 1:01
Monty26-Jan-07 1:01 
QuestionUsing Slider control in Win32 Pin
Ganesh_T6-Jan-07 0:28
Ganesh_T6-Jan-07 0:28 
AnswerRe: Using Slider control in Win32 Pin
Mark Salsbery6-Jan-07 5:55
Mark Salsbery6-Jan-07 5:55 
QuestionTextOut() Pin
Kiran Pinjala6-Jan-07 0:10
Kiran Pinjala6-Jan-07 0:10 
AnswerRe: TextOut() Pin
Johan Pretorius6-Jan-07 0:15
Johan Pretorius6-Jan-07 0:15 
AnswerRe: TextOut() Pin
Hadi Dayvary6-Jan-07 0:33
professionalHadi Dayvary6-Jan-07 0:33 
QuestionRe: TextOut() Pin
Kiran Pinjala7-Jan-07 18:28
Kiran Pinjala7-Jan-07 18:28 
AnswerRe: TextOut() Pin
Hamid_RT6-Jan-07 17:10
Hamid_RT6-Jan-07 17:10 
AnswerRe: TextOut() Pin
Stephen Hewitt7-Jan-07 11:44
Stephen Hewitt7-Jan-07 11:44 
QuestionAutomation Pin
HakunaMatada6-Jan-07 0:05
HakunaMatada6-Jan-07 0:05 
Questioncombo box in wndows 98? Pin
murali_utr5-Jan-07 20:40
murali_utr5-Jan-07 20:40 
QuestionRe: combo box in wndows 98? Pin
Hamid_RT5-Jan-07 21:34
Hamid_RT5-Jan-07 21:34 
AnswerRe: combo box in wndows 98? [modified] Pin
CPallini5-Jan-07 22:02
mveCPallini5-Jan-07 22:02 

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.