Click here to Skip to main content
15,917,642 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDraw barcode and MapMode Pin
includeh1024-Mar-06 23:55
includeh1024-Mar-06 23:55 
QuestionSending Fax using the FaxSendDocuemnt API Pin
aasstt24-Mar-06 23:02
aasstt24-Mar-06 23:02 
QuestionProblem with Controls on dialog box with images Pin
Ganesh_T24-Mar-06 21:50
Ganesh_T24-Mar-06 21:50 
AnswerRe: Problem with Controls on dialog box with images Pin
Hamid_RT29-Mar-06 6:46
Hamid_RT29-Mar-06 6:46 
GeneralRe: Problem with Controls on dialog box with images Pin
Ganesh_T29-Mar-06 19:20
Ganesh_T29-Mar-06 19:20 
GeneralRe: Problem with Controls on dialog box with images Pin
Hamid_RT30-Mar-06 2:01
Hamid_RT30-Mar-06 2:01 
Questionpure C question about accessing bits Pin
bouli24-Mar-06 21:42
bouli24-Mar-06 21:42 
AnswerRe: pure C question about accessing bits Pin
Justin Tay25-Mar-06 0:17
Justin Tay25-Mar-06 0:17 
I had to read what you had written several times. I gather that you have sets of data which is 2 bits in length (ie. of values 0 to 3)

The following code will get the value of the 2 bits at index i. I don't know what you mean by this being a 2D array. You would probably want to check that nArrayPos doesn't go over the bounds of the compressedArray.

<br />
unsigned char GetAt(unsigned char *compressedArray, int i)<br />
{<br />
  int nArrayPos = i / 4;<br />
  int nBytePos = (3 - (i % 4)) * 2;<br />
  return (compressedArray[nArrayPos] >> nBytePos) & 0x03;<br />
}<br />


If you want to check which bit is set for the result you could always do something like

<br />
if((result & 0x02) == 0x02) // 1st bit set<br />
if((result & 0x01) == 0x01) // 2nd bit set<br />

GeneralRe: pure C question about accessing bits Pin
bouli25-Mar-06 2:48
bouli25-Mar-06 2:48 
GeneralRe: pure C question about accessing bits Pin
Justin Tay25-Mar-06 5:25
Justin Tay25-Mar-06 5:25 
GeneralRe: pure C question about accessing bits Pin
bouli25-Mar-06 6:16
bouli25-Mar-06 6:16 
GeneralRe: pure C question about accessing bits Pin
Justin Tay25-Mar-06 6:33
Justin Tay25-Mar-06 6:33 
GeneralRe: pure C question about accessing bits Pin
bouli25-Mar-06 6:50
bouli25-Mar-06 6:50 
GeneralRe: pure C question about accessing bits Pin
bouli25-Mar-06 7:05
bouli25-Mar-06 7:05 
GeneralRe: pure C question about accessing bits Pin
bouli16-Apr-06 0:28
bouli16-Apr-06 0:28 
QuestionOnFind() Pin
fuschia24-Mar-06 21:35
fuschia24-Mar-06 21:35 
AnswerRe: OnFind() Pin
toxcct25-Mar-06 4:53
toxcct25-Mar-06 4:53 
GeneralRe: OnFind() Pin
fuschia25-Mar-06 16:07
fuschia25-Mar-06 16:07 
GeneralRe: OnFind() Pin
toxcct26-Mar-06 3:31
toxcct26-Mar-06 3:31 
QuestionRuntime Compression Pin
Waldermort24-Mar-06 21:19
Waldermort24-Mar-06 21:19 
AnswerRe: Runtime Compression Pin
Saurabh.Garg25-Mar-06 0:48
Saurabh.Garg25-Mar-06 0:48 
GeneralRe: Runtime Compression Pin
Waldermort25-Mar-06 1:28
Waldermort25-Mar-06 1:28 
AnswerRe: Runtime Compression Pin
Hamid_RT25-Mar-06 1:34
Hamid_RT25-Mar-06 1:34 
QuestionFlat DateTimePicker Class Pin
mikobi24-Mar-06 20:31
mikobi24-Mar-06 20:31 
AnswerRe: Flat DateTimePicker Class Pin
mikobi25-Mar-06 3:16
mikobi25-Mar-06 3: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.