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