Skip to content

Instantly share code, notes, and snippets.

@ZeroStride
Created August 3, 2010 05:57
Show Gist options
  • Save ZeroStride/505915 to your computer and use it in GitHub Desktop.
Save ZeroStride/505915 to your computer and use it in GitHub Desktop.
protected static float* AllocHGlobalAlignedF(int numToAlloc, out System.IntPtr freePtr)
{
freePtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * numToAlloc + 15);
return (float*)(((int)freePtr + 15) & ~ 0x0F);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment