去掉obi,使用自写绳索

This commit is contained in:
2026-02-23 20:51:03 +08:00
parent cb636f862d
commit 91e2309eeb
2011 changed files with 2593 additions and 190578 deletions

View File

@@ -1,49 +0,0 @@
#if (OBI_BURST && OBI_MATHEMATICS && OBI_COLLECTIONS)
using System;
using UnityEngine;
using Unity.Collections;
namespace Obi
{
public struct BatchLUT : IDisposable
{
public readonly int numBatches;
public readonly NativeArray<ushort> batchIndex;
public BatchLUT(int numBatches)
{
this.numBatches = numBatches;
batchIndex = new NativeArray<ushort>(UInt16.MaxValue + 1, Allocator.Persistent, NativeArrayOptions.ClearMemory);
const ushort end = UInt16.MaxValue;
ushort numBits = (ushort)(numBatches - 1);
// For each entry in the table, compute the position of the first '0' bit in the index, starting from the less significant bit.
// This is the index of the first batch where we can add the constraint to.
for (ushort value = 0; value < end; value++)
{
ushort valueCopy = value;
for (ushort i = 0; i < numBits; i++)
{
if ((valueCopy & 1) == 0)
{
batchIndex[value] = i;
break;
}
valueCopy >>= 1;
}
}
batchIndex[end] = numBits;
}
public void Dispose()
{
batchIndex.Dispose();
}
}
}
#endif