LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Version Check Code Optimize?

Solved!
Go to solution

@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?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 11 of 18
(2,074 Views)

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.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 12 of 18
(2,060 Views)

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 13 of 18
(2,055 Views)
Solution
Accepted by topic author jeff-m

@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!) 

 

VersionChecker.png

Message 14 of 18
(2,043 Views)

@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!

0 Kudos
Message 15 of 18
(2,028 Views)

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.

 

0 Kudos
Message 16 of 18
(2,018 Views)

@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! Smiley Very Happy

0 Kudos
Message 17 of 18
(2,010 Views)

wiebe@CARYA wrote:

0x1111222233334444 > 0x1112000000000000

 


0x1111222233334444 < 0x1112000000000000

Obviously.

0 Kudos
Message 18 of 18
(2,007 Views)