You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
967 B
36 lines
967 B
using System.Collections.Generic;
|
|
|
|
namespace Unity.UIWidgets.InternalBridge {
|
|
public static class NoAllocHelpersBridge<T> {
|
|
public static T[] ExtractArrayFromListT(List<T> list) {
|
|
return UnityEngine.NoAllocHelpers.ExtractArrayFromListT(list);
|
|
}
|
|
|
|
public static void ResizeList(List<T> list, int size) {
|
|
if (size < list.Count) {
|
|
list.RemoveRange(size, list.Count - size);
|
|
return;
|
|
}
|
|
|
|
if (size == list.Count) {
|
|
return;
|
|
}
|
|
|
|
if (list.Capacity < size) {
|
|
list.Capacity = size;
|
|
}
|
|
|
|
UnityEngine.NoAllocHelpers.ResizeList(list, size);
|
|
}
|
|
|
|
public static void EnsureListElemCount(List<T> list, int size) {
|
|
list.Clear();
|
|
if (list.Capacity < size) {
|
|
list.Capacity = size;
|
|
}
|
|
|
|
ResizeList(list, size);
|
|
}
|
|
}
|
|
}
|