I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
Not as an alternative to rounding, which is just wrong. But it's an extremely easy and fast way to cast your value to int. If you're doing fast graphics stuff, bitwise operations can be really useful.
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
If you're in the sort of situation where that optimisation is important, then you're probably keenly aware of what you're doing. I'd never recommend this to anyone who wasn't already an expert.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Do people really do things like exploit bitwise operators as an alternative to rounding? In 2021? (I get to say that today!)
Not as an alternative to rounding, which is just wrong. But it's an extremely easy and fast way to cast your value to int. If you're doing fast graphics stuff, bitwise operations can be really useful.
If you're in the sort of situation where that optimisation is important, then you're probably keenly aware of what you're doing. I'd never recommend this to anyone who wasn't already an expert.