Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

No reason that that parameter should be a pointer.

  • Loading branch information...
commit 845d4bddedd34ffce5f4873929084d0e585a8e69 1 parent eebd45d
@ZeroStride ZeroStride authored
View
10 Dust/Unsafe/Simulation/UnsafeSimulation.cs
@@ -37,10 +37,7 @@ public unsafe void AdvanceTime(float dt)
{
fixed (float* tstream = SystemData.TimeRemaining)
{
- fixed (int* numparticles = &_systemData._numParticles)
- {
- AdvanceTime(dt, pxstream, pystream, pzstream, vxstream, vystream, vzstream, tstream, numparticles);
- }
+ AdvanceTime(dt, pxstream, pystream, pzstream, vxstream, vystream, vzstream, tstream, _systemData._numParticles);
}
}
}
@@ -52,7 +49,7 @@ public unsafe void AdvanceTime(float dt)
[DllImport("UnmanagedSimulation.dll")]
private unsafe extern static void AdvanceTime(float dt, float* pX_stream, float* pY_stream, float* pZ_stream,
- float* vX_stream, float* vY_stream, float* vZ_stream, float* time_stream, int* num_particles);
+ float* vX_stream, float* vY_stream, float* vZ_stream, float* time_stream, int num_particles);
public int AddParticles(ref ISystemData particlesToAdd)
@@ -102,10 +99,9 @@ public ISystemData SystemData
}
set
{
-#if DEBUG
if (value.GetType() != typeof(GameClay.Dust.SoAData))
throw new System.ArgumentException("Supplied ISystemData was not of type GameClay.Dust.SoAData.");
-#endif
+
_systemData = (GameClay.Dust.SoAData)value;
}
}
View
5 UnmanagedSimulation/UnmanagedSimulation.c
@@ -22,12 +22,11 @@ __declspec(dllexport) void __cdecl AdvanceTime(
float* vY_stream,
float* vZ_stream,
float* time_stream,
- int* num_particles
+ int num_particles
)
{
- const int num = *num_particles;
int i;
- for(i = 0; i < num; i++)
+ for(i = 0; i < num_particles; i++)
{
*time_stream -= dt;
*time_stream++;
Please sign in to comment.
Something went wrong with that request. Please try again.