05-05-2024, 11:51 PM
When writing assembly, shl is better than mul, and shr is way better than div.
When writing c++, with constants, as dsman said, it shouldn't matter, if optimization is enabled. The c++ compiler should be able to optimize multiplications and divisions by constant powers of 2 into shifts.
_SHL(x, 2)
Ugh. I think i'd have rather seen it as a << operator. I don't think that would conflict with existing basic source code. Or even x _SHL 2 , in the same style as MOD or AND. But regardless, why is it a function at all? Couldn't the qb64 compiler treat it like an intrinsic, and just transform it into x << 2 ?
When writing c++, with constants, as dsman said, it shouldn't matter, if optimization is enabled. The c++ compiler should be able to optimize multiplications and divisions by constant powers of 2 into shifts.
_SHL(x, 2)
Ugh. I think i'd have rather seen it as a << operator. I don't think that would conflict with existing basic source code. Or even x _SHL 2 , in the same style as MOD or AND. But regardless, why is it a function at all? Couldn't the qb64 compiler treat it like an intrinsic, and just transform it into x << 2 ?