Skip to content

Commit efaa7e9

Browse files
committed
tidying
1 parent a9bd6e5 commit efaa7e9

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ steps:
1616
displayName: Ensure 3.1 SDK
1717
inputs:
1818
version: 3.1.x
19+
performMultiLevelLookup: true
1920

2021
- script: |
2122
dotnet build src\MagicScaler -c Dist --version-suffix ci$(Build.BuildNumber)

src/MagicScaler/Magic/HybridScaleTransform.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ unsafe private void process4A(byte* ipstart, byte* opstart, uint stride, bool ru
143143
ipe -= Vector256<byte>.Count;
144144
do
145145
{
146-
byte* ipn = ip + stride;
147146
var vi0 = Avx.LoadVector256(ip);
148-
var vi2 = Avx.LoadVector256(ipn);
147+
var vi2 = Avx.LoadVector256(ip + stride);
149148
ip += Vector256<byte>.Count;
150149

151150
var va0 = Avx2.MultiplyHigh(Avx2.Shuffle(vi0, vshufa).AsUInt16(), vscale);
@@ -204,9 +203,8 @@ unsafe private void process4A(byte* ipstart, byte* opstart, uint stride, bool ru
204203
ipe -= Vector128<byte>.Count;
205204
do
206205
{
207-
byte* ipn = ip + stride;
208206
var vi0 = Sse2.LoadVector128(ip);
209-
var vi2 = Sse2.LoadVector128(ipn);
207+
var vi2 = Sse2.LoadVector128(ip + stride);
210208
ip += Vector128<byte>.Count;
211209

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

389-
if (IntPtr.Size == sizeof(ulong) && stride > sizeof(ulong) * 2)
387+
if (IntPtr.Size == sizeof(ulong) && stride >= sizeof(ulong) * 2)
390388
{
391389
const ulong mask0 = 0xfffffffful;
392390
const ulong mask1 = 0xfffffffful << 32;
@@ -635,7 +633,7 @@ unsafe private void process(byte* ipstart, byte* opstart, uint stride, bool rup)
635633
else
636634
#endif
637635

638-
if (IntPtr.Size == sizeof(ulong) && stride > sizeof(ulong))
636+
if (IntPtr.Size == sizeof(ulong) && stride >= sizeof(ulong))
639637
{
640638
ulong m = maskb;
641639

src/MagicScaler/Utilities/SimpleLruCache.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal interface IMultiDisposable : IDisposable
88
bool TryAddRef();
99
}
1010

11-
internal sealed class SimpleLruCache<TKey, TValue> where TKey : IEquatable<TKey> where TValue : class, IMultiDisposable
11+
internal sealed class SimpleLruCache<TKey, TValue> where TKey : IEquatable<TKey> where TValue : IMultiDisposable
1212
{
1313
private const int maxItems = 8;
1414

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

36-
private bool tryGetInternal(TKey key, [NotNullWhen(true)] out TValue? value)
36+
private bool tryGetInternal(TKey key, [MaybeNullWhen(false)] out TValue value)
3737
{
3838
for (var curr = head; !(curr is null); curr = curr.Next)
3939
{
@@ -85,7 +85,7 @@ private bool tryGetInternal(TKey key, [NotNullWhen(true)] out TValue? value)
8585
return false;
8686
}
8787

88-
public bool TryGet(TKey key, [NotNullWhen(true)] out TValue? value)
88+
public bool TryGet(TKey key, [MaybeNullWhen(false)] out TValue value)
8989
{
9090
lock (sync)
9191
{

0 commit comments

Comments
 (0)