Hi,
let’s assume we have a MemoryBlock of size 5, whose bytes are 12345. If now I increase the size to 7, it will have two extra zeros on the right 1234500. However, I want to end up with a MemoryBlock with the zeros on the left 0012345. Is there a more efficient way that looping on the whole MB like the code below? Consider that the MB could be very large so I want to avoid the loop as I am looking for performance.
Thanks!
mb.Size = mb.Size + n
for i As Integer = mb.Size-1 DownTo n
mb.Byte(i) = mb.Byte(i-n)
next
for i As Integer = 0 To n-1
mb.Byte(i) = 0
next