Dynamic arrays are
reference counted, so you don't need to explicitly call SetLength to zero. They will be released automatically when the variable goes out of the scope.
As long as optimizations are enabled, both versions will have equivalent performance as the compiler replaces 256 multipliers with bit shifts. You can confirm this by turning optimization on and then watching generated assembly code. The only difference in this case will be the second approach being more difficult to understand, so I'd recommend sticking to the first approach.
Bookmarks