A more general bsr/bsf implementation
Johan Engelen via Digitalmars-d
digitalmars-d at puremagic.com
Sun Apr 12 08:21:24 PDT 2015
>> 2) Is the current sign-extend up to size_t's width really
>> intended behavior?
>
> It's due to integer promotions, so it should only influence bsr
> (when it is called with a signed type.)
Sorry for not being clear.
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
More information about the Digitalmars-d
mailing list