Simplify Arithmetic operations.
When including constants in arithmetic operations, compound the values together where possible. For example, instead of coding ;
offset = 224 + revstart + 1;
code
offset = 225 + revstart ;
This is especially time consuming for large datasets. If this makes the code less clear, add a comment to explain the use.
Where possible, use multiply rather than divide (e.g. Use X=X*0.5 rather than X=X/2), since multiplication is quicker.
Additionally, when dividing,
if division by zero is a (frequent) possibility test for this before
dividing. If the divisor used in division is zero, the operation
becomes far slower. However, testing for a zero also uses CPU so some
consideration of this is necessary.