Skip to content

Commit

Permalink
fix include condition
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Mar 25, 2024
1 parent 05a181d commit a1e1471
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
11 changes: 6 additions & 5 deletions src/ZString.Unity/Assets/Scripts/ZString/EnumUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ static EnumUtil()
utf8names = new Dictionary<T, byte[]>(enumNames.Length);
for (int i = 0; i < enumNames.Length; i++)
{
if (names.ContainsKey((T)values.GetValue(i)))
var value = (T)values.GetValue(i)!;
if (names.ContainsKey(value))
{
// already registered = invalid.
names[(T)values.GetValue(i)] = InvalidName;
utf8names[(T)values.GetValue(i)] = Array.Empty<byte>(); // byte[0] == Invalid.
names[value] = InvalidName;
utf8names[value] = Array.Empty<byte>(); // byte[0] == Invalid.
}
else
{
names.Add((T)values.GetValue(i), enumNames[i]);
utf8names.Add((T)values.GetValue(i), Encoding.UTF8.GetBytes(enumNames[i]));
names.Add(value, enumNames[i]);
utf8names.Add(value, Encoding.UTF8.GetBytes(enumNames[i]));
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/ZString.Unity/Assets/Scripts/ZString/Number/BitOperations.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
#if !NET6_0_OR_GREATER

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand All @@ -15,7 +17,7 @@ namespace System.Numerics
/// The methods use hardware intrinsics when available on the underlying platform,
/// otherwise they use optimized software fallbacks.
/// </summary>
public static class BitOperations
internal static class BitOperations
{
// C# no-alloc optimization that directly wraps the data section of the dll (similar to string constants)
// https://github.com/dotnet/roslyn/pull/24621
Expand Down Expand Up @@ -281,4 +283,6 @@ public static uint RotateRight(uint value, int offset)
public static ulong RotateRight(ulong value, int offset)
=> (value >> offset) | (value << (64 - offset));
}
}
}

#endif
2 changes: 1 addition & 1 deletion src/ZString.Unity/Assets/Scripts/ZString/Shims.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD2_1
#if NETSTANDARD

using System;
using System.Globalization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void ThrowFormatException()

static void ThrowNestedException()
{
throw new NestedStringBuilderCreationException(nameof(Utf16ValueStringBuilder));
throw new NestedStringBuilderCreationException(nameof(Utf8ValueStringBuilder));
}

private void AppendFormatInternal<T>(T arg, int width, StandardFormat format, string argName)
Expand Down
10 changes: 7 additions & 3 deletions src/ZString/Number/BitOperations.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
#if !NET6_0_OR_GREATER

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand All @@ -15,7 +17,7 @@ namespace System.Numerics
/// The methods use hardware intrinsics when available on the underlying platform,
/// otherwise they use optimized software fallbacks.
/// </summary>
public static class BitOperations
internal static class BitOperations
{
// C# no-alloc optimization that directly wraps the data section of the dll (similar to string constants)
// https://github.com/dotnet/roslyn/pull/24621
Expand Down Expand Up @@ -281,4 +283,6 @@ public static uint RotateRight(uint value, int offset)
public static ulong RotateRight(ulong value, int offset)
=> (value >> offset) | (value << (64 - offset));
}
}
}

#endif
2 changes: 1 addition & 1 deletion src/ZString/Shims.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETSTANDARD2_1
#if NETSTANDARD

using System;
using System.Globalization;
Expand Down
2 changes: 1 addition & 1 deletion src/ZString/ZString.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</ItemGroup>

<ItemGroup>
<Compile Remove="Number\**\*.cs" Condition="$(TargetFramework) == 'netstandard2.1'" />
<Compile Remove="Number\**\*.cs" Condition="$(TargetFramework) == 'net6.0' or $(TargetFramework) == 'net7.0'" />
<Compile Remove="Unity\**\**" />
<None Remove="Unity\**\**" />
</ItemGroup>
Expand Down

0 comments on commit a1e1471

Please sign in to comment.