mirror of
https://github.com/chylex/Brotli-Builder.git
synced 2024-11-24 22:42:50 +01:00
28 lines
786 B
C#
28 lines
786 B
C#
using System;
|
|
|
|
namespace BrotliImpl.Utils{
|
|
static class Match{
|
|
public static bool Check(in ArraySegment<byte> bytes, int current, int candidate, int length){
|
|
for(int offset = 0; offset < length; offset++){
|
|
if (bytes[current + offset] != bytes[candidate + offset]){
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static int DetermineLength(in ArraySegment<byte> bytes, int current, int candidate, int limit){
|
|
int matched = 0;
|
|
|
|
while(matched < limit && bytes[current] == bytes[candidate]){
|
|
++current;
|
|
++candidate;
|
|
++matched;
|
|
}
|
|
|
|
return matched;
|
|
}
|
|
}
|
|
}
|