bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exec3.sub never finishes with huge argmax


From: Lawrence Velázquez
Subject: Re: exec3.sub never finishes with huge argmax
Date: Sat, 07 Jun 2025 17:02:30 -0400

On Sat, Jun 7, 2025, at 12:55 PM, Martin D Kealey wrote:
> However there might be some objections to relying on the printf built-in,
> since in theory Bash could be built without it, in which case I suggest:
>
> [...]
>
> +for (( m = n = argmax / ${#argmax} + 1 ; o = m & m-1 ; m = o )) do :; done
> +v=
> +for ((; m ; m >>= 1 )) do
> +    v+=$v
> +    (( n & m )) && v+=$argmax

It can also be built without arithmetic for loops and arithmetic
commands, so I don't think such objections would be reasonable.

-- 
vq



reply via email to

[Prev in Thread] Current Thread [Next in Thread]