Quote:
Originally Posted by comphappy
If you need the extra places the most efficient way to do it will be to bit shift the dividend, and remember that any time you need to do a calculation, you need to bit shift the result back. using bit shift instead of multiplying by something like 10 will save you a few clock cycles.
multiplication 8-bit by 8-bit method (if you multiply by an arbitrary value such as 10)
see here http://www.dcc.unicamp.br/~celio/mc4...los/mul8x8.asm
Program Memory : 14 locations
# of cycles : 71
RAM : 5 locations
That is a really big waist
bit shift method
c equivalent
x<<1;
can be done with the single asm command lrol (load and rotate left)
|
I would warn against using this for the reasons outlined before (granted it *should* work)...
The key reason being that you as a programmer really shouldn't have to worry about things like that as it is the compilers problem. Most compilers are written so that operations are optimized (for special cases like the one above).
Unless you are writing hardware drivers you don't need to worry about assembly level optimization. Even hardware shaders (which are run directly on graphics cards) are now written in a C-like language rather than in assembly like before.