diff --git a/Misaki.HighPerformance.Jobs/JobScheduler.cs b/Misaki.HighPerformance.Jobs/JobScheduler.cs index 39cb10f..736185e 100644 --- a/Misaki.HighPerformance.Jobs/JobScheduler.cs +++ b/Misaki.HighPerformance.Jobs/JobScheduler.cs @@ -247,20 +247,20 @@ public sealed unsafe class JobScheduler : IDisposable public JobHandle Schedule(ref T job, int threadIndex, JobHandle dependency) where T : unmanaged, IJob { - var jobData = _jobDataAllocator.Allocate(MemoryUtility.SizeOf(), MemoryUtility.AlignOf()); - if (jobData == null) + var pJobData = _jobDataAllocator.Allocate(MemoryUtility.SizeOf(), MemoryUtility.AlignOf()); + if (pJobData == null) { return JobHandle.Invalid; } fixed (T* pJob = &job) { - MemoryUtility.MemCpy(pJob, jobData, MemoryUtility.SizeOf()); + MemoryUtility.MemCpy(pJobData, pJob, MemoryUtility.SizeOf()); } var jobInfo = new JobInfo { - pJobData = jobData, + pJobData = pJobData, pExecutionFunc = &JobExecutor.Execute, remainingBatches = 1, @@ -323,15 +323,15 @@ public sealed unsafe class JobScheduler : IDisposable public JobHandle ScheduleParallel(ref T job, int totalIteration, int batchSize, int threadIndex, JobHandle dependency) where T : unmanaged, IJobParallelFor { - var jobData = _jobDataAllocator.Allocate(MemoryUtility.SizeOf(), MemoryUtility.AlignOf()); - if (jobData == null) + var pJobData = _jobDataAllocator.Allocate(MemoryUtility.SizeOf(), MemoryUtility.AlignOf()); + if (pJobData == null) { return JobHandle.Invalid; } fixed (T* pJob = &job) { - MemoryUtility.MemCpy(pJob, jobData, MemoryUtility.SizeOf()); + MemoryUtility.MemCpy(pJobData, pJob, MemoryUtility.SizeOf()); } var optimalBatchSize = Math.Max(1, batchSize); @@ -339,7 +339,7 @@ public sealed unsafe class JobScheduler : IDisposable var jobInfo = new JobInfo { - pJobData = jobData, + pJobData = pJobData, pExecutionFunc = &JobExecutor.ExecuteParallel, remainingBatches = totalBatches, diff --git a/Misaki.HighPerformance.Jobs/TempJobAllocator.cs b/Misaki.HighPerformance.Jobs/TempJobAllocator.cs index 23bfc1b..1b7c0b3 100644 --- a/Misaki.HighPerformance.Jobs/TempJobAllocator.cs +++ b/Misaki.HighPerformance.Jobs/TempJobAllocator.cs @@ -66,7 +66,7 @@ public unsafe struct TempJobAllocator : IAllocator, IDisposable return null; } - MemoryUtility.MemCpy(newPtr, ptr, Math.Min(oldSize, newSize)); + MemoryUtility.MemCpy(ptr, newPtr,Math.Min(oldSize, newSize)); return newPtr; } diff --git a/Misaki.HighPerformance.LowLevel/Collections/UnTypedArray.cs b/Misaki.HighPerformance.LowLevel/Collections/UnTypedArray.cs index fdabbda..be267a9 100644 --- a/Misaki.HighPerformance.LowLevel/Collections/UnTypedArray.cs +++ b/Misaki.HighPerformance.LowLevel/Collections/UnTypedArray.cs @@ -123,7 +123,7 @@ public unsafe struct UnTypedArray : IUnTypedCollection fixed (T* pDest = destination) { - MemCpy(_buffer, pDest, _size); + MemCpy(pDest, _buffer, _size); } } @@ -147,7 +147,7 @@ public unsafe struct UnTypedArray : IUnTypedCollection fixed (T* pDest = destination) { - MemCpy((byte*)_buffer + sourceOffset, pDest + destinationIndex, length * sizeOfElement); + MemCpy(pDest + destinationIndex, (byte*)_buffer + sourceOffset, length * sizeOfElement); } } @@ -169,7 +169,7 @@ public unsafe struct UnTypedArray : IUnTypedCollection fixed (T* pSrc = source) { - MemCpy(pSrc, _buffer, sourceSize); + MemCpy(_buffer, pSrc, sourceSize); } } @@ -193,7 +193,7 @@ public unsafe struct UnTypedArray : IUnTypedCollection fixed (T* pSrc = source) { - MemCpy(pSrc + sourceIndex, (byte*)_buffer + destinationOffset, length * sizeOfElement); + MemCpy((byte*)_buffer + destinationOffset, pSrc + sourceIndex, length * sizeOfElement); } } diff --git a/Misaki.HighPerformance.LowLevel/Utilities/UnsafeCollectionExtensions.cs b/Misaki.HighPerformance.LowLevel/Utilities/UnsafeCollectionExtensions.cs index d6fafe5..a5fea03 100644 --- a/Misaki.HighPerformance.LowLevel/Utilities/UnsafeCollectionExtensions.cs +++ b/Misaki.HighPerformance.LowLevel/Utilities/UnsafeCollectionExtensions.cs @@ -29,7 +29,7 @@ public static unsafe class UnsafeCollectionExtensions fixed (T* pDest = destination) { - MemCpy(source.GetUnsafePtr(), pDest, (uint)(source.Count * sizeof(T))); + MemCpy(pDest, source.GetUnsafePtr(), (uint)(source.Count * sizeof(T))); } } @@ -54,7 +54,7 @@ public static unsafe class UnsafeCollectionExtensions fixed (T* pDest = destination) { - MemCpy((byte*)source.GetUnsafePtr() + sourceIndex * sizeof(T), pDest + destinationIndex, (uint)(length * sizeof(T))); + MemCpy(pDest + destinationIndex, (byte*)source.GetUnsafePtr() + sourceIndex * sizeof(T), (uint)(length * sizeof(T))); } } @@ -76,7 +76,7 @@ public static unsafe class UnsafeCollectionExtensions fixed (T* pSrc = source) { - MemCpy(pSrc, destination.GetUnsafePtr(), (uint)(source.Length * sizeof(T))); + MemCpy(destination.GetUnsafePtr(), pSrc, (uint)(source.Length * sizeof(T))); } } @@ -101,7 +101,7 @@ public static unsafe class UnsafeCollectionExtensions fixed (T* pSrc = source) { - MemCpy(pSrc + sourceIndex, (byte*)destination.GetUnsafePtr() + destinationIndex * sizeof(T), (uint)(length * sizeof(T))); + MemCpy((byte*)destination.GetUnsafePtr() + destinationIndex * sizeof(T), pSrc + sourceIndex, (uint)(length * sizeof(T))); } } @@ -118,7 +118,7 @@ public static unsafe class UnsafeCollectionExtensions var array = new UnsafeArray(source.Length, allocator); fixed (T* pSrc = source) { - MemCpy(pSrc, array.GetUnsafePtr(), (uint)(source.Length * sizeof(T))); + MemCpy(array.GetUnsafePtr(), pSrc, (uint)(source.Length * sizeof(T))); } return array; @@ -137,7 +137,7 @@ public static unsafe class UnsafeCollectionExtensions var list = new UnsafeList(source.Count, allocator); fixed (T* pSrc = CollectionsMarshal.AsSpan(source)) { - MemCpy(pSrc, list.GetUnsafePtr(), (uint)(source.Count * sizeof(T))); + MemCpy(list.GetUnsafePtr(), pSrc, (uint)(source.Count * sizeof(T))); } return list; @@ -171,4 +171,4 @@ public static unsafe class UnsafeCollectionExtensions span.CopyTo(CollectionsMarshal.AsSpan(list)); return list; } -} \ No newline at end of file +}