File tree Expand file tree Collapse file tree
UnityAsset.NET/Compression Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ public static unsafe int Decode(ReadOnlySpan<byte> source, Span<byte> target)
2727 literalLength += b ;
2828 } while ( b == 0xFF && s < sourceEnd ) ;
2929 }
30+
3031 Buffer . MemoryCopy ( s , t , literalLength , literalLength ) ;
3132 s += literalLength ;
3233 t += literalLength ;
@@ -43,10 +44,24 @@ public static unsafe int Decode(ReadOnlySpan<byte> source, Span<byte> target)
4344 matchLength += b ;
4445 } while ( b == 0xFF && s < sourceEnd ) ;
4546 }
47+
4648 matchLength += 4 ;
47- Buffer . MemoryCopy ( t - offset , t , matchLength , matchLength ) ;
49+
50+ while ( matchLength > offset )
51+ {
52+ Buffer . MemoryCopy ( t - offset , t , offset , offset ) ;
53+ t += offset ;
54+ matchLength -= offset ;
55+ }
56+
57+ if ( matchLength > 0 )
58+ {
59+ Buffer . MemoryCopy ( t - offset , t , matchLength , matchLength ) ;
60+ }
61+
4862 t += matchLength ;
4963 }
64+
5065 return ( int ) ( t - targetPtr ) ;
5166 }
5267 }
You can’t perform that action at this time.
0 commit comments