Android Question problem.. please help!

Beja

Expert
Licensed User
Longtime User
4 bytes, e.g. 67 E3 90 AF
I want a unique value of the summation of the 4 MSBs of each byte, for the four bytes.
That means you will cut drop away the 4 LSB bits from each byte.. then you will have 4 nipples.
Now if I just stitch the for nipples together (16 bits) that will give me a unique value that can
not be repeated when the order of the 4 nipples change.. but this will be a long number of 16 bits,
so if possible, is there a way to have the sum be in 1 byte, or at least 1 byte and a flag?

Thanks in advance.
 

eps

Expert
Licensed User
Longtime User
?

6 + E + 9 + A

?

Can you provide a little more information about what you are trying to achieve please?
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
It is not possible.
You are saying that you want a 16-bit unique number to be represented by 8-bits? Think about it.

What is possible is to have some kind of signature/crc where it is highly unlikely but not impossible to have collisions. You could add or xor the bits in sequence.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Thanks thedesolatesoul,
That's sad there is no possibility.. I want zero chance of collision. But will keep knocking the mind door and will not give up.
If there is any workaround or outside the box solution.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
In fact, the trick is the flag... try to find a "constant" and use as a flag.

Thanks edgar,
"find" or "define"?
please teach me how to use a constant as a flag.
(sometimes you dig for oil but you find gold)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…