Skip to content

Commit

Permalink
tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
saucecontrol committed Feb 22, 2020
1 parent a9bd6e5 commit efaa7e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ steps:
displayName: Ensure 3.1 SDK
inputs:
version: 3.1.x
performMultiLevelLookup: true

- script: |
dotnet build src\MagicScaler -c Dist --version-suffix ci$(Build.BuildNumber)
Expand Down
10 changes: 4 additions & 6 deletions src/MagicScaler/Magic/HybridScaleTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ unsafe private void process4A(byte* ipstart, byte* opstart, uint stride, bool ru
ipe -= Vector256<byte>.Count;
do
{
byte* ipn = ip + stride;
var vi0 = Avx.LoadVector256(ip);
var vi2 = Avx.LoadVector256(ipn);
var vi2 = Avx.LoadVector256(ip + stride);
ip += Vector256<byte>.Count;

var va0 = Avx2.MultiplyHigh(Avx2.Shuffle(vi0, vshufa).AsUInt16(), vscale);
Expand Down Expand Up @@ -204,9 +203,8 @@ unsafe private void process4A(byte* ipstart, byte* opstart, uint stride, bool ru
ipe -= Vector128<byte>.Count;
do
{
byte* ipn = ip + stride;
var vi0 = Sse2.LoadVector128(ip);
var vi2 = Sse2.LoadVector128(ipn);
var vi2 = Sse2.LoadVector128(ip + stride);
ip += Vector128<byte>.Count;

var va0 = Sse2.MultiplyHigh(Ssse3.Shuffle(vi0, vshufa).AsUInt16(), vscale);
Expand Down Expand Up @@ -386,7 +384,7 @@ unsafe private void process4(byte* ipstart, byte* opstart, uint stride, bool rup
else
#endif

if (IntPtr.Size == sizeof(ulong) && stride > sizeof(ulong) * 2)
if (IntPtr.Size == sizeof(ulong) && stride >= sizeof(ulong) * 2)
{
const ulong mask0 = 0xfffffffful;
const ulong mask1 = 0xfffffffful << 32;
Expand Down Expand Up @@ -635,7 +633,7 @@ unsafe private void process(byte* ipstart, byte* opstart, uint stride, bool rup)
else
#endif

if (IntPtr.Size == sizeof(ulong) && stride > sizeof(ulong))
if (IntPtr.Size == sizeof(ulong) && stride >= sizeof(ulong))
{
ulong m = maskb;

Expand Down
6 changes: 3 additions & 3 deletions src/MagicScaler/Utilities/SimpleLruCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal interface IMultiDisposable : IDisposable
bool TryAddRef();
}

internal sealed class SimpleLruCache<TKey, TValue> where TKey : IEquatable<TKey> where TValue : class, IMultiDisposable
internal sealed class SimpleLruCache<TKey, TValue> where TKey : IEquatable<TKey> where TValue : IMultiDisposable
{
private const int maxItems = 8;

Expand All @@ -33,7 +33,7 @@ public CacheNode(TKey key, TValue value)
private CacheNode? tail = null;
private volatile int count = 0;

private bool tryGetInternal(TKey key, [NotNullWhen(true)] out TValue? value)
private bool tryGetInternal(TKey key, [MaybeNullWhen(false)] out TValue value)
{
for (var curr = head; !(curr is null); curr = curr.Next)
{
Expand Down Expand Up @@ -85,7 +85,7 @@ private bool tryGetInternal(TKey key, [NotNullWhen(true)] out TValue? value)
return false;
}

public bool TryGet(TKey key, [NotNullWhen(true)] out TValue? value)
public bool TryGet(TKey key, [MaybeNullWhen(false)] out TValue value)
{
lock (sync)
{
Expand Down

0 comments on commit efaa7e9

Please sign in to comment.