diff --git a/Src/Enums.NET.MemoryUsageTest/Enums.NET.MemoryUsageTest.csproj b/Src/Enums.NET.MemoryUsageTest/Enums.NET.MemoryUsageTest.csproj index 12f3893..db5fede 100644 --- a/Src/Enums.NET.MemoryUsageTest/Enums.NET.MemoryUsageTest.csproj +++ b/Src/Enums.NET.MemoryUsageTest/Enums.NET.MemoryUsageTest.csproj @@ -7,6 +7,14 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Src/Enums.NET.PerfTestConsole/Enums.NET.PerfTestConsole.csproj b/Src/Enums.NET.PerfTestConsole/Enums.NET.PerfTestConsole.csproj index 13acb8a..2061d8d 100644 --- a/Src/Enums.NET.PerfTestConsole/Enums.NET.PerfTestConsole.csproj +++ b/Src/Enums.NET.PerfTestConsole/Enums.NET.PerfTestConsole.csproj @@ -9,6 +9,14 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Src/Enums.NET.Test/Enums.NET.Test.csproj b/Src/Enums.NET.Test/Enums.NET.Test.csproj index 2de4370..3015f7a 100644 --- a/Src/Enums.NET.Test/Enums.NET.Test.csproj +++ b/Src/Enums.NET.Test/Enums.NET.Test.csproj @@ -7,6 +7,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Src/Enums.NET.Test/Issues/Issue40.cs b/Src/Enums.NET.Test/Issues/Issue40.cs new file mode 100644 index 0000000..ea954a1 --- /dev/null +++ b/Src/Enums.NET.Test/Issues/Issue40.cs @@ -0,0 +1,27 @@ +using System; +using NUnit.Framework; + +namespace EnumsNET.Tests.Issues +{ + [TestFixture] + public class Issue40 + { + [Test] + public void GetFlags_SuccessfullyEnumerates_WhenUsingLargeCertainEnumValue() + { + CollectionAssert.AreEqual(new[] { MyEnum.Val1, MyEnum.Val40 }, ((MyEnum)1610612801).GetFlags()); + } + + [Flags] + public enum MyEnum + { + Unknown = 0x0, + Val1 = 0x1, + Val4 = 0x4, + Val8 = 0x8, + Val10 = 0x10, + Val40 = 0x40, + Val80 = 0x80, + } + } +} diff --git a/Src/Enums.NET.TestEnums/Enums.NET.TestEnums.csproj b/Src/Enums.NET.TestEnums/Enums.NET.TestEnums.csproj index c8e93d4..dc9b4f1 100644 --- a/Src/Enums.NET.TestEnums/Enums.NET.TestEnums.csproj +++ b/Src/Enums.NET.TestEnums/Enums.NET.TestEnums.csproj @@ -7,6 +7,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Src/Enums.NET/EnumCache.cs b/Src/Enums.NET/EnumCache.cs index b3032d2..bf6a437 100644 --- a/Src/Enums.NET/EnumCache.cs +++ b/Src/Enums.NET/EnumCache.cs @@ -1326,7 +1326,7 @@ private IEnumerable> Enum TUnderlyingOperations operations = default; var validValue = operations.And(value, _allFlags); var checkForZero = operations.LessThan(validValue, default) || operations.LessThan(operations.LeftShift(validValue, 1), validValue); - for (var currentValue = operations.One; checkForZero ? !currentValue.Equals(default) : !operations.LessThan(value, currentValue); currentValue = operations.LeftShift(currentValue, 1)) + for (var currentValue = operations.One; checkForZero ? !currentValue.Equals(default) : !operations.LessThan(validValue, currentValue); currentValue = operations.LeftShift(currentValue, 1)) { if (HasAnyFlags(validValue, currentValue)) { diff --git a/Src/Enums.NET/Enums.NET.csproj b/Src/Enums.NET/Enums.NET.csproj index e1b2da1..0b8b0d6 100644 --- a/Src/Enums.NET/Enums.NET.csproj +++ b/Src/Enums.NET/Enums.NET.csproj @@ -2,10 +2,10 @@ net45;netcoreapp3.0;netstandard2.1;netstandard2.0;netstandard1.3;netstandard1.1;netstandard1.0 4.0.0.0 - 4.0.0 - 4.0.0 + 4.0.1 + 4.0.1 - 4.0.0 + 4.0.1 False Tyler Brinkley Enums.NET is a high-performance type-safe .NET enum utility library @@ -29,6 +29,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +