private byte *AddStateConsolidate(byte *stateToFind)
        {
            // Try to find a matching state. If not found, then add a new one
            byte *targetState;

            if (_temporalStateStorage.TryToFindState(stateToFind, out targetState))
            {
                return(targetState);
            }

            targetState = _temporalStateStorage.GetFreeTemporalSpaceAddress();
            MemoryBuffer.Copy(stateToFind, targetState, _temporalStateStorage.StateVectorSize);

            return(targetState);
        }
示例#2
0
        private byte *AddState(int originalState)
        {
            // Try to find a matching state. If not found, then add a new one
            byte *targetState;

            int *stateToFind = stackalloc int[1];

            stateToFind[0] = originalState;

            if (_temporalStateStorage.TryToFindState((byte *)stateToFind, out targetState))
            {
                return(targetState);
            }

            targetState = _temporalStateStorage.GetFreeTemporalSpaceAddress();
            var targetStateAsInt = (int *)targetState;

            // create new state
            targetStateAsInt[0] = originalState;
            return(targetState);
        }