Thread overview
Unsigned comparison operators
September 29
I love the D >>> operator and I use it a lot. So much safer than the chaos in C.

I would absolutely love to have unsigned comparison operators in D. Do you agree? What on earth would the syntax be like?

Yes, I could write a generic function or something, but the result would look ugly. And I would have to be very careful not to screw up type conversions (although i’m pretty sure there is some help available in the rtl to assist in getting the job done safely).
September 29
On Friday, 29 September 2017 at 11:20:13 UTC, Cecil Ward wrote:
> I love the D >>> operator and I use it a lot. So much safer than the chaos in C.
>
> I would absolutely love to have unsigned comparison operators in D. Do you agree? What on earth would the syntax be like?
>
> Yes, I could write a generic function or something, but the result would look ugly. And I would have to be very careful not to screw up type conversions (although i’m pretty sure there is some help available in the rtl to assist in getting the job done safely).

I have a hard time imagining a use case.

The reason why he have signed shift in the first place is to make the (n >> m) be equivalent to n * (2^^m)

October 18
On Friday, 29 September 2017 at 14:13:07 UTC, Stefan Koch wrote:

> I have a hard time imagining a use case.

It just came up in a real application. It was a case of bit-twiddling, happened to come up during some weird 'arithmetic' when trying to write a jump-free replacement expression for a ? : because the compiler still generated jumps for a ? : when I didn't want it to. (A jump-less attempt at Bresenham's line algorithm.)