codeGen cloneArray: use index based for loop instead of pointer based

The index-based version is 14% faster than the pointer-based version,
when cloning an array of 17 unit elements on a 64-bit machine.