diff options
author | pacien | 2018-11-30 18:44:20 +0100 |
---|---|---|
committer | pacien | 2018-11-30 18:44:20 +0100 |
commit | 5bbe75659aef55542268cbf35c66342cb22ce865 (patch) | |
tree | 53c1e79c4195be546ba5762d61eb995a4f9e0530 /src | |
parent | e88f60b63cb05f56a61060a953c726b7a78c0652 (diff) | |
download | gziplike-5bbe75659aef55542268cbf35c66342cb22ce865.tar.gz |
isolate lzss chain module
Diffstat (limited to 'src')
-rw-r--r-- | src/lzss/listpolyfill.nim (renamed from src/polyfill.nim) | 2 | ||||
-rw-r--r-- | src/lzss/lzsschain.nim (renamed from src/lzsschain.nim) | 3 | ||||
-rw-r--r-- | src/lzss/lzssencoder.nim (renamed from src/lzssencoder.nim) | 2 | ||||
-rw-r--r-- | src/lzss/lzssnode.nim (renamed from src/lzssnode.nim) | 0 | ||||
-rw-r--r-- | src/lzss/matchtable.nim (renamed from src/matchtable.nim) | 4 |
5 files changed, 6 insertions, 5 deletions
diff --git a/src/polyfill.nim b/src/lzss/listpolyfill.nim index b252953..00b30ee 100644 --- a/src/polyfill.nim +++ b/src/lzss/listpolyfill.nim | |||
@@ -26,7 +26,7 @@ proc prepend*[T](L: var SinglyLinkedList[T], n: SinglyLinkedNode[T]) = | |||
26 | 26 | ||
27 | proc prepend*[T](L: var SinglyLinkedList[T], value: T) = | 27 | proc prepend*[T](L: var SinglyLinkedList[T], value: T) = |
28 | ## prepends a node to `L`. Efficiency: O(1). | 28 | ## prepends a node to `L`. Efficiency: O(1). |
29 | polyfill.prepend(L, newSinglyLinkedNode(value)) | 29 | listpolyfill.prepend(L, newSinglyLinkedNode(value)) |
30 | 30 | ||
31 | proc append*[T](L: var SinglyLinkedList[T], n: SinglyLinkedNode[T]) = | 31 | proc append*[T](L: var SinglyLinkedList[T], n: SinglyLinkedNode[T]) = |
32 | ## appends a node `n` to `L`. Efficiency: O(1). | 32 | ## appends a node `n` to `L`. Efficiency: O(1). |
diff --git a/src/lzsschain.nim b/src/lzss/lzsschain.nim index 44200f2..2ecff9e 100644 --- a/src/lzsschain.nim +++ b/src/lzss/lzsschain.nim | |||
@@ -15,7 +15,8 @@ | |||
15 | # along with this program. If not, see <https://www.gnu.org/licenses/>. | 15 | # along with this program. If not, see <https://www.gnu.org/licenses/>. |
16 | 16 | ||
17 | import lists, tables, sugar | 17 | import lists, tables, sugar |
18 | import polyfill, integers, lzssnode, huffman/huffmantree | 18 | import ../integers, ../huffman/huffmantree |
19 | import listpolyfill, lzssnode | ||
19 | 20 | ||
20 | const maxChainByteLength = 32_000 * wordBitLength | 21 | const maxChainByteLength = 32_000 * wordBitLength |
21 | 22 | ||
diff --git a/src/lzssencoder.nim b/src/lzss/lzssencoder.nim index 05f3a16..8b750fb 100644 --- a/src/lzssencoder.nim +++ b/src/lzss/lzssencoder.nim | |||
@@ -15,7 +15,7 @@ | |||
15 | # along with this program. If not, see <https://www.gnu.org/licenses/>. | 15 | # along with this program. If not, see <https://www.gnu.org/licenses/>. |
16 | 16 | ||
17 | import lists | 17 | import lists |
18 | import polyfill, matchtable, lzssnode, lzsschain | 18 | import listpolyfill, matchtable, lzssnode, lzsschain |
19 | 19 | ||
20 | const matchGroupLength = 3 | 20 | const matchGroupLength = 3 |
21 | const maxRefByteLength = high(uint8).int + matchGroupLength | 21 | const maxRefByteLength = high(uint8).int + matchGroupLength |
diff --git a/src/lzssnode.nim b/src/lzss/lzssnode.nim index de5958d..de5958d 100644 --- a/src/lzssnode.nim +++ b/src/lzss/lzssnode.nim | |||
diff --git a/src/matchtable.nim b/src/lzss/matchtable.nim index 5be652c..b17ce68 100644 --- a/src/matchtable.nim +++ b/src/lzss/matchtable.nim | |||
@@ -15,7 +15,7 @@ | |||
15 | # along with this program. If not, see <https://www.gnu.org/licenses/>. | 15 | # along with this program. If not, see <https://www.gnu.org/licenses/>. |
16 | 16 | ||
17 | import tables, lists | 17 | import tables, lists |
18 | import polyfill | 18 | import listpolyfill |
19 | 19 | ||
20 | type MatchTable*[K, V] = | 20 | type MatchTable*[K, V] = |
21 | TableRef[K, SinglyLinkedList[V]] | 21 | TableRef[K, SinglyLinkedList[V]] |
@@ -28,5 +28,5 @@ proc matchList*[K, V](matchTable: MatchTable[K, V], pattern: K): SinglyLinkedLis | |||
28 | 28 | ||
29 | proc addMatch*[K, V](matchTable: MatchTable[K, V], pattern: K, value: V) = | 29 | proc addMatch*[K, V](matchTable: MatchTable[K, V], pattern: K, value: V) = |
30 | var matchList = matchTable.matchList(pattern) | 30 | var matchList = matchTable.matchList(pattern) |
31 | polyfill.prepend(matchList, value) | 31 | listpolyfill.prepend(matchList, value) |
32 | matchTable[pattern] = matchList | 32 | matchTable[pattern] = matchList |