Click here to Skip to main content
16,011,538 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Edit box and cursor position Pin
Steve S19-Nov-04 0:49
Steve S19-Nov-04 0:49 
GeneralRe: Edit box and cursor position Pin
Jack Puppy19-Nov-04 0:49
Jack Puppy19-Nov-04 0:49 
GeneralRe: Edit box and cursor position Pin
22491719-Nov-04 0:57
22491719-Nov-04 0:57 
GeneralSaving variables with odd bit sizes Pin
rikkemus19-Nov-04 0:25
rikkemus19-Nov-04 0:25 
GeneralRe: Saving variables with odd bit sizes Pin
Jack Puppy19-Nov-04 0:32
Jack Puppy19-Nov-04 0:32 
GeneralRe: Saving variables with odd bit sizes Pin
Steve S19-Nov-04 0:43
Steve S19-Nov-04 0:43 
GeneralRe: Saving variables with odd bit sizes Pin
rikkemus19-Nov-04 1:16
rikkemus19-Nov-04 1:16 
GeneralRe: Saving variables with odd bit sizes Pin
Bob Flynn19-Nov-04 1:14
Bob Flynn19-Nov-04 1:14 
Try to pack your data into the standard word size for your machine (32 bits for example). So for example if you have 15 bit values that you have to store, pack them into a 32 bit word by:
unsigned int a[] = {1023,2032};
unsigned int c[2];
unsigned int b;
a[0] = 1023;
a[1] = 2032;
b= (a[0]<<15)+a[1];
c[0]= b >> 15;
c[1] = b & 0x1FFF;

Be careful to pay attention to sign extention rules for your give compiler. This same procedure can be used for any number of bits.
In this case you still carry two bits of overhead, but it is very easy and efficient. If that is still not accpetable, you will need to write a slightly more complex algorithm that will allow you to place values across word boundaries.

Good luck with your project.
GeneralRe: Saving variables with odd bit sizes Pin
Henry miller19-Nov-04 2:14
Henry miller19-Nov-04 2:14 
GeneralRe: Saving variables with odd bit sizes Pin
Bob Flynn19-Nov-04 2:34
Bob Flynn19-Nov-04 2:34 
GeneralRe: Saving variables with odd bit sizes Pin
rikkemus19-Nov-04 2:55
rikkemus19-Nov-04 2:55 
GeneralRe: Saving variables with odd bit sizes Pin
Bob Flynn19-Nov-04 3:53
Bob Flynn19-Nov-04 3:53 
GeneralRe: Saving variables with odd bit sizes Pin
Henry miller19-Nov-04 6:03
Henry miller19-Nov-04 6:03 
GeneralRe: Saving variables with odd bit sizes Pin
rikkemus19-Nov-04 12:21
rikkemus19-Nov-04 12:21 
Generalnewbie needs help Pin
marinme19-Nov-04 0:19
marinme19-Nov-04 0:19 
GeneralRe: newbie needs help Pin
Steve S19-Nov-04 0:27
Steve S19-Nov-04 0:27 
GeneralRe: newbie needs help Pin
toxcct19-Nov-04 1:01
toxcct19-Nov-04 1:01 
GeneralRe: newbie needs help Pin
Henry miller19-Nov-04 2:19
Henry miller19-Nov-04 2:19 
GeneralRe: newbie needs help Pin
toxcct19-Nov-04 5:40
toxcct19-Nov-04 5:40 
GeneralRe: newbie needs help Pin
Jeryth2-Feb-05 6:14
Jeryth2-Feb-05 6:14 
GeneralRe: newbie needs help Pin
toxcct3-Feb-05 2:47
toxcct3-Feb-05 2:47 
GeneralDatabase for C++ Pin
Gammenon18-Nov-04 23:14
Gammenon18-Nov-04 23:14 
GeneralRe: Database for C++ Pin
Steve S18-Nov-04 23:44
Steve S18-Nov-04 23:44 
GeneralRe: Database for C++ Pin
Gammenon18-Nov-04 23:53
Gammenon18-Nov-04 23:53 
GeneralRe: Database for C++ Pin
Steve S19-Nov-04 0:01
Steve S19-Nov-04 0:01 

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.