Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Root797706yBenchmark this versus all other approaches. You'll find this (or rather: an optimized version of this killing half the compares) is the most performant.
When every cycle matters, all the fancy approaches (especially anything using friggin' string casting) are worse than useless.
Come on. It's like people don't understand memory and clocks even exist. 😡 -
@Root I almost thought that noone would understand it in the age of VM languages or JavaScript / python all over the place... Luv ya'
-
@Root in that case I would expect a comment explaining exactly that. Even if it is faster, you need to stop people from being "smart" trying to refactor it.
Such hacks should be documented if they're needed. -
@Root it is only going to return a number less than 255, why not make it a short
-
Root797706y@calmyourtities ahh I assumed you meant the arg type; apologies! Yeah. No idea. It should absolutely be a byte/unsigned char/short, though.
-
@calmyourtities @Root not at all. You should use the types defines in stdint.h. Everything else is dangerous and should be avoided.
Related Rants
It works.. I guess? 🤣🤣
joke/meme
bad code
c++
fail