Array.Copy on Multi Dimensional Arrays?
Ok. 1 D arrays are pretty easy.
For example:
VB Code:
'somewhere...
Private Declare Sub ShiftMemoryLong Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Long, hpvSource As Long, ByVal cbCopy As Long)
'somewhere else...
Private Sub PULL_CELL(ByVal M_Spot As Long, ByVal OUT_VAL As Long)
'we don't need out_val anymore
Num_Is_Used(OUT_VAL - LowNum) = True
If M_Spot <> SlidingSourceTop Then
Call ShiftMemoryLong(SourceNums(M_Spot), SourceNums(M_Spot + 1), 4 * (SlidingSourceTop - M_Spot))
End If
End Sub
Private Sub PUSH_CELL(ByVal M_Spot As Long, ByRef OUT_VAL As Long)
If M_Spot <> SlidingSourceTop Then
Call ShiftMemoryLong(SourceNums(M_Spot + 1), SourceNums(M_Spot), 4 * (SlidingSourceTop - M_Spot))
End If
SourceNums(M_Spot) = OUT_VAL
Num_Is_Used(OUT_VAL - LowNum) = False
End Sub
easily converts to:
VB Code:
Private Sub PULL_CELL(ByVal M_Spot As Integer, ByVal OUT_VAL As Integer)
Num_Is_Used(OUT_VAL - LowNum) = True
If M_Spot <> SlidingSourceTop Then
Array.Copy(SourceNums, (M_Spot + 1), SourceNums, (M_Spot), (SlidingSourceTop - M_Spot))
End If
End Sub
Private Sub PUSH_CELL(ByVal M_Spot As Integer, ByRef OUT_VAL As Integer)
If M_Spot <> SlidingSourceTop Then
Array.Copy(SourceNums, (M_Spot), SourceNums, (M_Spot + 1), (SlidingSourceTop - M_Spot))
End If
SourceNums(M_Spot) = OUT_VAL
End Sub
But how can I convert the following to Array.Copy?
VB Code:
ShiftMemoryLong MyParaLowLims(MainLev, LastLimitLift), MyParaLowLims(MainLev, LastLimitLift - 1), 4 * (MaxLev + 1 - MainLev)
ShiftMemoryLong MyParaHighLims(MainLev, LastLimitLift), MyParaHighLims(MainLev, LastLimitLift - 1), 4 * (MaxLev + 1 - MainLev)
:wave: