Pages: [1]   Go Down
Author Topic: Encoding data using C++  (Read 322 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi

Does anyone knows how to encode higher bit data into smaller bit data...
for example. i have higher bit data as 1,0,1,1,0,1,..........32-bit data. How to encode this 32-bit data into for 8-bit data.
I know this is possible.

Can we implement it using HASH algorithm or some other?

Please reply as soon as possible.....
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8458
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How to encode this 32-bit data into for 8-bit data.

Assuming you mean four 8-bit data.

Code:
8_bit_val_1 = 32_bit_val >> 24;
8_bit_val_2 = (32_bit_val >> 16) & 0xFF;
8_bit_val_3 = (32_bit_val >> 8) & 0xFF;
8_bit_val_4 = 32_bit_val & 0xFF;


______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Pages: [1]   Go Up
Jump to: