I am working with audio data. I’d like to play the sample file in reverse. The data is stored as unsigned ints and packed nice and tight. Is there a way to call memcpy that will copy in reverse order. i.e. if I had 1,2,3,4 stored in an array, could I call memcpy and magically reverse them so I get 4,3,2,1.
I am working with audio data. I’d like to play the sample file in
Share
This works for copying
ints in reverse:Just like
memcpy(), the regions pointed-to bydstandsrcmust not overlap.If you want to reverse in-place:
Both the functions above are portable. You might be able to make them faster by using hardware-specific code.
(I haven’t tested the code for correctness.)