From 68732032e04f0f7f811cfadd1e98b5e7ee46845f Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sat, 23 Feb 2013 23:16:47 -0600 Subject: [PATCH] Interlocked.Increment returns the incremented value, not the original value --- runtime/CSharp/Antlr4.Runtime/Dfa/DFA.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/CSharp/Antlr4.Runtime/Dfa/DFA.cs b/runtime/CSharp/Antlr4.Runtime/Dfa/DFA.cs index a26a1f3f0..45112db85 100644 --- a/runtime/CSharp/Antlr4.Runtime/Dfa/DFA.cs +++ b/runtime/CSharp/Antlr4.Runtime/Dfa/DFA.cs @@ -98,7 +98,7 @@ namespace Antlr4.Runtime.Dfa public virtual DFAState AddState(DFAState state) { - state.stateNumber = Interlocked.Increment(ref nextStateNumber); + state.stateNumber = Interlocked.Increment(ref nextStateNumber) - 1; return states.GetOrAdd(state, state); }