HLSf use nuint rather than long, L4 now uses hlsf rather than array to alloc cache line.

This commit is contained in:
Youmu Liu
2026-04-20 18:10:14 +08:00
parent 1b7c929be4
commit 2e2d64a2ce
38 changed files with 796 additions and 465 deletions
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Common.Collections;
using StgSharp.Mathematics.Memory;
using StgSharp.Collections;
using StgSharp.HighPerformance.Memory;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -61,6 +61,9 @@ namespace StgSharp.HighPerformance.Memory
if (!_idReuse.TryPop(out int id)) {
id = _largestId++;
}
if (id > short.MaxValue) {
throw new OverflowException("Too many predictors in waiting");
}
_predictors[id] = predict;
_predictionQueue.Enqueue(id);
return id;
@@ -90,8 +93,7 @@ namespace StgSharp.HighPerformance.Memory
}
if (_predictionQueue.TryDequeue(out int id))
{
IL4Predict predict = _predictors[id] ??
throw new L4PredictUnregisteredException(id);
IL4Predict predict = _predictors[id] ?? throw new L4PredictUnregisteredException(id);
CurrentPredict = predict;
CurrentPredictIndex = id;
return true;