Closed Luhrel closed 2 years ago
What about adding support for
rhs
-parameter to <<
and <<=
>>
and >>=
operatorboth calling truncating (integer) divide by two, @Luhrel.
For the sake of making semantics of bit-shift operators even more conformant with builtin integer types.
Division already mimics truncating division as, for instance,
assert(27.Z / 10.Z == 2);
assert(27.Z / 10 == 2);
assert(27.Z / 10UL == 2);
What do you think @9il?
I would rather go with methods like mulPow2
to make code more obvious.
I would rather go with methods like
mulPow2
to make code more obvious.
Ok. But that makes code less substitutable and less generic.
The operators are good as well. That isn't something critical.
What about adding support for
1. signed integer `rhs`-parameter to `<<` and `<<=` 2. `>>` and `>>=` operator
both calling truncating (integer) divide by two, @Luhrel.
It's a good idea.
Thanks!