| Isn't it 2 ^ ceil(log(ival) / log(2))?
For instance:
-nm0
instr 1
ival = 2
loop:
inextpowof2 = 2 ^ ceil(log(ival) / log(2))
prints "%d\t%d%n", ival, inextpowof2
loop_lt ival, 1, 1026, loop
endin
i 1 0 0
e
Or did I misunderstand you?
(I took this formula from a code of Jacob, I think.)
Best -
joachim
Am 16.05.2010 um 22:45 schrieb Oeyvind Brandtsegg:
> In connection to the request from Josh regarding looping with
> skiptime,
> we don't need a "loopskip" opcode,
> but what *could* be a proposition for a new opcode (or operator) is a
> next-pow-of-two method.
> Something like @ that exists as a score operator.
>
> With this we would not need to do
>
> findpow2:
> if ipowsize > ilength goto done
> ipowsize = ipowsize * 2
> goto findpow2
> done:
>
> Not terribly important, but next-pow-of-two could be considered a
> commonly needed low level building block
>
> best
> Oeyvind
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |