Added test package in nix flake to automatically run tests.
To be able to do such, it was required to add the vendor directory to the git project.
This commit is contained in:
1 parent
459dc26b4f
commit
1f2ea8b7e5
15 files changed
+2619
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
// This module is browser compatible.
|
||||
|
||||
export const DEFAULT_CHUNK_SIZE = 16_640;
|
||||
export const DEFAULT_BUFFER_SIZE = 32 * 1024;
|
||||
|
||||
/** Generate longest proper prefix which is also suffix array. */
|
||||
export function createLPS(pat: Uint8Array): Uint8Array {
|
||||
const lps = new Uint8Array(pat.length);
|
||||
lps[0] = 0;
|
||||
let prefixEnd = 0;
|
||||
let i = 1;
|
||||
while (i < lps.length) {
|
||||
if (pat[i] == pat[prefixEnd]) {
|
||||
prefixEnd++;
|
||||
lps[i] = prefixEnd;
|
||||
i++;
|
||||
} else if (prefixEnd === 0) {
|
||||
lps[i] = 0;
|
||||
i++;
|
||||
} else {
|
||||
prefixEnd = lps[prefixEnd - 1];
|
||||
}
|
||||
}
|
||||
return lps;
|
||||
}
|
||||
Reference in new issue
Block a user