A more general bsr/bsf implementation
safety0ff via Digitalmars-d
digitalmars-d at puremagic.com
Mon Apr 13 07:40:20 PDT 2015
On Sunday, 12 April 2015 at 15:21:26 UTC, Johan Engelen wrote:
>
> Sorry for not being clear.
I should have thought about it more before answering. :)
> I understand why the current bsr behaves like it does, but what
> I meant is whether that is the desired behavior of bsr:
> bsr( byte(-1) ) == 31 (32-bit size_t)
> bsr( byte(-1) ) == 63 (64-bit size_t)
> instead of
> bsr( byte(-1) ) == 7
I think 7 is the desired result.
I don't know whether there are uses for bsr with negative signed
arguments since it returns the MSB position for all values.
More information about the Digitalmars-d
mailing list