Data Merging Tips

There are three sets of data a, b, c, the value range is 0-9, 0-2, 0-5, how to use a byte (8 bits) M to express it?

 

Coding Scheme:

M=(a*3+b)*6+c

 

Decoding scheme:

c = M%6;

b = M/6%3;

a = M/6/3;

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326698601&siteId=291194637
Recommended