1 to 62 types can be detected, see example with the processing of 23 possible types:
00000000010100000100101
In the representation above, types 1,3,6,12 and 14 were positive (1)
The first digit one (1) on the right refers to type 1
The second zero (0) digit on the right to type 2
.... up to the last zero (0) digit referring to type 23
then we can say the following:
This result with 23 different types of infections can be represented by a number:
Result(x)=%00000000010100000100101 = 10277 (decimal)
Everything is working perfectly in the system, I need to increase the processing speed of the following command that counts how many types were positive in the simulation, see how it is currently programmed:
n=CountString(Bin(Result(x)),"1") in this case n=5
Here we have another result with 23 processed types:
Result(y)=%10000000000100000000100 = 4196356 (decimal)
n2=CountString(Bin(Result(y)),"1") in this case n2=3
See that using this methodology I can see how many equal types occurred in the two samples:
match=CountString(Bin(Result(x) & Result(y)),"1") in this case match=2
Processings can have from 1 to 62 binary digits:
from %1 to %1111111111.....111111 ( 62 numbers 1 = 4611686018427387903 )
How can I increase the speed of the below routine:
Code: Select all
DisableDebugger
input1.q=%00000000010100000100101
input2.q=%10000000000100000000100
t1 = ElapsedMilliseconds()
For i = 1 To 100000000
Result = CountString(Bin(input1 & input2),"1")
Next
t2 = ElapsedMilliseconds()
MessageRequester("End",Str(Int((t2-t1)/1000))+" seconds", #PB_MessageRequester_Ok)
Any help will be welcome.
thanks