I am converting a very dirty C program to Swift3, and their is plenty of pointer arithmetic to be dealt with. As part of the effort, I have created a 'memcpy clone to help with some of the transformation.
Here is the output from the REPL:
1. var source = [UInt8](repeating: 0x1f, count: 32)
2. var destination = [UInt8](repeating: 0, count: 64)
4. func memcpy(dest: inout [UInt8], src: inout [UInt8], count: Int)
6. for ix in 0...count-1
8. dest[ix] = src[ix]
12. memcpy(dest: &destination, src: &source, count: 32 )
14. memcpy(dest: &destination, src: &source, count: 13)
error: repl.swift:14:26: error: cannot convert value of type 'UInt8' to expected argument type '[UInt8]'
memcpy(dest: &destination, src: &source, count: 13)
which shows me that the compiler does not like the form of &destination, and doesn't treat it as a [UInt8].
What is the correct syntax for using a base + offset as a source or destination for a memory copy?