07-12-2007 02:40 PM - edited 07-12-2007 02:40 PM
Here's a quick draft how you could consolidate.
(Of course if you have a multiprocessor unit, you need to balance the need for parallel operations with the problem of forcing multiple subarray allocations. Only careful benchmarks will be able to tell what's better.)
Message Edited by altenbach on 07-12-2007 12:42 PM
07-12-2007 02:50 PM
Thanks very much for your time. I will try to rebuild and understand your example.
Regarding 1., what problems could occur, as you say i probably need a FOR loop? You mean the 4 parallel lines supplying the subset icons?
07-12-2007 03:12 PM
@randerson wrote:
Regarding 1., what problems could occur, as you say i probably need a FOR loop? You mean the 4 parallel lines supplying the subset icons?
Yes, you do all your code in quadruplicate, meaning all the icons occur in four different places. Imagine you later want to split the array in e.g. 16 subset, suddenly you need three screens full of duplicate code! 😮
Duplicate code also makes it hard to debug and test. If you have one copy of the code in a FOR loop, it is easy to make modifications (e.g. if you suddenly need to check for >1). In your code, you would need to make the same change in four different places and if you forget one, the results will be wrong. You also need to validate the code in four different places. What if some wires are crossed or missing in one of the code paths? You might never notice!
You also have all these diagram costants, another source for typos! It is much safer to derive all numbers from parent sizes (all the code really needs to know is 640 and 480 in this case).