Code:what would take longer?
add two bytes, or add two floats or add byte and float.
Printable View
Code:what would take longer?
add two bytes, or add two floats or add byte and float.
I been thinking bout this all day, cant figure any answer
Write your code and time it.
Or use a profiler.
You'd have to do it several million times to notice any difference with a profiler.
It would depend a lot on the hardware used, I would think. I can't see adding two bytes being slower than adding two floats, however.
Also note that adding a byte and a float would involve promoting the byte to a float first. I'm not sure how efficient that is -- probably very much so.