public static int ShuffleHeap(List <int> newPermutation) { IntPtr newPermutationPtr = PlatformInvoke.DDV_AllocateIntArray(newPermutation.Count); for (int i = 0; i < newPermutation.Count; i++) { PlatformInvoke.DDV_SetElementIntArray(newPermutationPtr, i, newPermutation[i]); } int result = PlatformInvoke.Cudd_ShuffleHeap(manager, newPermutationPtr); PlatformInvoke.DDV_FreeIntArray(newPermutationPtr); return(result); }