Notifications
Clear all
May 31, 2017 2:34 am
fn lastbit7 bits =
(
pivot = 1
while (p = (pivot + bits.count)/2) > pivot do
(
bb = #{p+1..bits.count} * bits
if not bb.isEmpty then
(
bits = bb
pivot = p
)
else
(
bits = #{pivot..p} * bits
)
)
(bits as array)[1]
)
here is a binary cut without recursion and .numberset
1 Reply
May 31, 2017 2:34 am
something is missed in my last method… it’s loosing some performance with no sense. i don’t have time right now to fix it. maybe later…
May 31, 2017 2:34 am
the only one comment… maximum float ‘integer’ is 16777216 so your method implementation is limited by this count
May 31, 2017 2:34 am
Replace (bits as array)[1] by bits.count and you get another 20% improvement ;)… And a little less memory ussage too.
3 Replies
May 31, 2017 6:04 pm
fn lastbit7 bits =
(
pivot = 1
while (p = (pivot + bits.count)/2) > pivot do
(
bb = #{p+1..bits.count} * bits
if bb.isEmpty then
(
bits = #{pivot..p} * bits
)
else
(
bits = bb
pivot = p
)
)
bits.count
)
also i removed not before empty check
May 31, 2017 6:04 pm
fn lastbit7 bits =
(
pivot = 1
while (p = (pivot + bits.count)/2) > pivot do
(
bb = #{p+1..bits.count} * bits
if bb.isEmpty then [B]bits.count = p[/B]
else
(
bits = bb
pivot = p
)
)
p+1
)
the only thing i still don’t like is
bb = #{p+1..bits.count} * bits