10-19-2017 09:34 AM
@altenbach wrote:
@PiDi wrote:
Bundle the versions into cluster, compare clusters:
This is incorrect. For example if the major version is higher, the other numbers can be lower and we still have a good match.
Are you sure about that? The comparison would yield a cluster of T/F, change it to an array and AND them together and if even one is F the result is F. Or maybe I misunderstood what you meant?
10-19-2017 10:01 AM
billko ha scritto:
@altenbach wrote:
@PiDi wrote:
Bundle the versions into cluster, compare clusters:
This is incorrect. For example if the major version is higher, the other numbers can be lower and we still have a good match.
Are you sure about that? The comparison would yield a cluster of T/F, change it to an array and AND them together and if even one is F the result is F. Or maybe I misunderstood what you meant?
Comparisons must be done in cascade (Major has priority over Minor which has priority over Fix which has priority over Build).
You cannot take into account this with a simple AND.
10-19-2017 10:12 AM
@pincpanter wrote:
billko ha scritto:
@altenbach wrote:
@PiDi wrote:
Bundle the versions into cluster, compare clusters:
This is incorrect. For example if the major version is higher, the other numbers can be lower and we still have a good match.
Are you sure about that? The comparison would yield a cluster of T/F, change it to an array and AND them together and if even one is F the result is F. Or maybe I misunderstood what you meant?
Comparisons must be done in cascade (Major has priority over Minor which has priority over Fix which has priority over Build).
You cannot take into account this with a simple AND.
LOL - you're right - I forgot all about that.
10-19-2017 11:00 AM - edited 10-19-2017 11:28 AM
@altenbach wrote:
What is the range of possible values for the number between the dots? If each fit into a U8 (0..255), you could just cast the entire number set into U32 and compare with the value obtained from the minimum version.
Here's how it would look like using U16...U64. (each number can be 0..65535, probably sufficient).
(This is just a rough draft. Please verify correct operations. Also note that you had duplicate dialogs. One is sufficient!)
10-19-2017 11:52 AM
@altenbach wrote:
@altenbach wrote:
What is the range of possible values for the number between the dots? If each fit into a U8 (0..255), you could just cast the entire number set into U32 and compare with the value obtained from the minimum version.
Here's how it would look like using U16...U64. (each number can be 0..65535, probably sufficient).
Tested and it works great. I like this a lot. I've use the Type Cast in a few other cases, but it's still a little bit of a black box to me. I appreciate the help from all of you guys.
Thank you for the help!
10-19-2017 12:42 PM
Think of an U16 as two bytes. It's value is from 0x0000 to 0xFFFF. So the 4 number in an array look like this (assume values 0x1111, 0x2222, 0x3333, 0x4444):
0x1111
0x2222
0x3333
Ox4444
The cast maps this memory layout to the U64, 8 bytes, or 0x0000000000000000 to 0xFFFFFFFFFFFFFFFF. After the cast, the number looks like this:
0x1111222233334444
This compares exactly as you want. For example:
0x1111222233334444 > 0x1110222233334444
0x1111222233334444 > 0x1111222233334344
0x1111222233334444 < 0x1114222233334444
0x1111222233334444 > 0x1112000000000000
Create an indicator from the U64 values, and set it's radix to hex. Change the values , and you should get a good idea of how it works.
10-19-2017 02:12 PM
@billko wrote:
@pincpanter wrote:
billko ha scritto:
@altenbach wrote:
@PiDi wrote:
Bundle the versions into cluster, compare clusters:
This is incorrect. For example if the major version is higher, the other numbers can be lower and we still have a good match.
Are you sure about that? The comparison would yield a cluster of T/F, change it to an array and AND them together and if even one is F the result is F. Or maybe I misunderstood what you meant?
Comparisons must be done in cascade (Major has priority over Minor which has priority over Fix which has priority over Build).
You cannot take into account this with a simple AND.
LOL - you're right - I forgot all about that.
YES! I'm not the only one here! ![]()
10-19-2017 02:23 PM
wiebe@CARYA wrote:0x1111222233334444 > 0x1112000000000000
0x1111222233334444 < 0x1112000000000000
Obviously.