Skip to content

Commit

Permalink
Simplifies FlagSet and reduces code size
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Dandy committed Nov 24, 2023
1 parent 7aaa10d commit 9d3cc78
Show file tree
Hide file tree
Showing 20 changed files with 491 additions and 364 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net48</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;net48</TargetFrameworks>
<NoWarn>$(NoWarn);IDE1006</NoWarn>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
Expand Down
38 changes: 0 additions & 38 deletions WeCantSpell.Hunspell.v3.ncrunchsolution.user

This file was deleted.

8 changes: 4 additions & 4 deletions WeCantSpell.Hunspell/AffixCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public AffixesByFlagsEnumerator(FlagSet flags, Dictionary<FlagValue, AffixGroup<

private AffixGroup<TAffixEntry> _group;
private Dictionary<FlagValue, AffixGroup<TAffixEntry>> _byFlag;
private FlagValue[] _flags;
private char[] _flags;
private TAffixEntry _current;
private int _flagsIndex;
private int _groupIndex;
Expand All @@ -418,7 +418,7 @@ private bool MoveNextGroup()
{
while (_flagsIndex < _flags.Length)
{
if (_byFlag.TryGetValue(_flags[_flagsIndex++], out _group!) && _group.Entries.Length != 0)
if (_byFlag.TryGetValue((FlagValue)_flags[_flagsIndex++], out _group!) && _group.Entries.Length != 0)
{
_groupIndex = 0;
return true;
Expand All @@ -441,7 +441,7 @@ public GroupsByFlagsEnumerator(FlagSet flags, Dictionary<FlagValue, AffixGroup<T

private Dictionary<FlagValue, AffixGroup<TAffixEntry>> _byFlag;
private AffixGroup<TAffixEntry> _current;
private FlagValue[] _flags;
private char[] _flags;
private int _flagsIndex;

public AffixGroup<TAffixEntry> Current => _current;
Expand All @@ -452,7 +452,7 @@ public bool MoveNext()
{
while (_flagsIndex < _flags.Length)
{
if (_byFlag.TryGetValue(_flags[_flagsIndex++], out _current!))
if (_byFlag.TryGetValue((FlagValue)_flags[_flagsIndex++], out _current!))
{
return true;
}
Expand Down
Loading

0 comments on commit 9d3cc78

Please sign in to comment.