(I'm assuming that Value
is an int
as well.)
0.8 times x
is the same as (4 times x
) divided by five. Multiplying an integer by a power of 2 can be done very quickly with a bit-shift. You can do this explicitly if you know how, but any modern compiler will automatically optimize int x = ...; x *= 8;
to a bit-shift for you, so you don't need to worry about it. Details about how to do this by hand are widely available if you are interested.
So one thing to try is (Value * 4) / 5
.