chd 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +30 -0
- data/chd.gemspec +29 -0
- data/ext/chd.c +1008 -0
- data/ext/extconf.rb +60 -0
- data/lib/chd/cd.rb +272 -0
- data/lib/chd/metadata.rb +196 -0
- data/lib/chd/version.rb +4 -0
- data/lib/chd.rb +21 -0
- data/libchdr/CMakeLists.txt +104 -0
- data/libchdr/LICENSE.txt +24 -0
- data/libchdr/README.md +7 -0
- data/libchdr/deps/lzma-19.00/CMakeLists.txt +33 -0
- data/libchdr/deps/lzma-19.00/LICENSE +3 -0
- data/libchdr/deps/lzma-19.00/include/7zTypes.h +375 -0
- data/libchdr/deps/lzma-19.00/include/Alloc.h +51 -0
- data/libchdr/deps/lzma-19.00/include/Bra.h +64 -0
- data/libchdr/deps/lzma-19.00/include/Compiler.h +33 -0
- data/libchdr/deps/lzma-19.00/include/CpuArch.h +336 -0
- data/libchdr/deps/lzma-19.00/include/Delta.h +19 -0
- data/libchdr/deps/lzma-19.00/include/LzFind.h +121 -0
- data/libchdr/deps/lzma-19.00/include/LzHash.h +57 -0
- data/libchdr/deps/lzma-19.00/include/Lzma86.h +111 -0
- data/libchdr/deps/lzma-19.00/include/LzmaDec.h +234 -0
- data/libchdr/deps/lzma-19.00/include/LzmaEnc.h +76 -0
- data/libchdr/deps/lzma-19.00/include/LzmaLib.h +131 -0
- data/libchdr/deps/lzma-19.00/include/Precomp.h +10 -0
- data/libchdr/deps/lzma-19.00/include/Sort.h +18 -0
- data/libchdr/deps/lzma-19.00/lzma-history.txt +446 -0
- data/libchdr/deps/lzma-19.00/lzma.txt +328 -0
- data/libchdr/deps/lzma-19.00/lzma.vcxproj +543 -0
- data/libchdr/deps/lzma-19.00/lzma.vcxproj.filters +17 -0
- data/libchdr/deps/lzma-19.00/src/Alloc.c +455 -0
- data/libchdr/deps/lzma-19.00/src/Bra86.c +82 -0
- data/libchdr/deps/lzma-19.00/src/BraIA64.c +53 -0
- data/libchdr/deps/lzma-19.00/src/CpuArch.c +218 -0
- data/libchdr/deps/lzma-19.00/src/Delta.c +64 -0
- data/libchdr/deps/lzma-19.00/src/LzFind.c +1127 -0
- data/libchdr/deps/lzma-19.00/src/Lzma86Dec.c +54 -0
- data/libchdr/deps/lzma-19.00/src/LzmaDec.c +1185 -0
- data/libchdr/deps/lzma-19.00/src/LzmaEnc.c +1330 -0
- data/libchdr/deps/lzma-19.00/src/Sort.c +141 -0
- data/libchdr/deps/zlib-1.2.11/CMakeLists.txt +29 -0
- data/libchdr/deps/zlib-1.2.11/ChangeLog +1515 -0
- data/libchdr/deps/zlib-1.2.11/FAQ +368 -0
- data/libchdr/deps/zlib-1.2.11/INDEX +68 -0
- data/libchdr/deps/zlib-1.2.11/Makefile +5 -0
- data/libchdr/deps/zlib-1.2.11/Makefile.in +410 -0
- data/libchdr/deps/zlib-1.2.11/README +115 -0
- data/libchdr/deps/zlib-1.2.11/adler32.c +186 -0
- data/libchdr/deps/zlib-1.2.11/compress.c +86 -0
- data/libchdr/deps/zlib-1.2.11/configure +921 -0
- data/libchdr/deps/zlib-1.2.11/crc32.c +442 -0
- data/libchdr/deps/zlib-1.2.11/crc32.h +441 -0
- data/libchdr/deps/zlib-1.2.11/deflate.c +2163 -0
- data/libchdr/deps/zlib-1.2.11/deflate.h +349 -0
- data/libchdr/deps/zlib-1.2.11/doc/algorithm.txt +209 -0
- data/libchdr/deps/zlib-1.2.11/doc/rfc1950.txt +619 -0
- data/libchdr/deps/zlib-1.2.11/doc/rfc1951.txt +955 -0
- data/libchdr/deps/zlib-1.2.11/doc/rfc1952.txt +675 -0
- data/libchdr/deps/zlib-1.2.11/doc/txtvsbin.txt +107 -0
- data/libchdr/deps/zlib-1.2.11/gzclose.c +25 -0
- data/libchdr/deps/zlib-1.2.11/gzguts.h +218 -0
- data/libchdr/deps/zlib-1.2.11/gzlib.c +637 -0
- data/libchdr/deps/zlib-1.2.11/gzread.c +654 -0
- data/libchdr/deps/zlib-1.2.11/gzwrite.c +665 -0
- data/libchdr/deps/zlib-1.2.11/infback.c +640 -0
- data/libchdr/deps/zlib-1.2.11/inffast.c +323 -0
- data/libchdr/deps/zlib-1.2.11/inffast.h +11 -0
- data/libchdr/deps/zlib-1.2.11/inffixed.h +94 -0
- data/libchdr/deps/zlib-1.2.11/inflate.c +1561 -0
- data/libchdr/deps/zlib-1.2.11/inflate.h +125 -0
- data/libchdr/deps/zlib-1.2.11/inftrees.c +304 -0
- data/libchdr/deps/zlib-1.2.11/inftrees.h +62 -0
- data/libchdr/deps/zlib-1.2.11/make_vms.com +867 -0
- data/libchdr/deps/zlib-1.2.11/treebuild.xml +116 -0
- data/libchdr/deps/zlib-1.2.11/trees.c +1203 -0
- data/libchdr/deps/zlib-1.2.11/trees.h +128 -0
- data/libchdr/deps/zlib-1.2.11/uncompr.c +93 -0
- data/libchdr/deps/zlib-1.2.11/zconf.h +534 -0
- data/libchdr/deps/zlib-1.2.11/zconf.h.cmakein +536 -0
- data/libchdr/deps/zlib-1.2.11/zconf.h.in +534 -0
- data/libchdr/deps/zlib-1.2.11/zlib.3 +149 -0
- data/libchdr/deps/zlib-1.2.11/zlib.3.pdf +0 -0
- data/libchdr/deps/zlib-1.2.11/zlib.h +1912 -0
- data/libchdr/deps/zlib-1.2.11/zlib.map +94 -0
- data/libchdr/deps/zlib-1.2.11/zlib.pc.cmakein +13 -0
- data/libchdr/deps/zlib-1.2.11/zlib.pc.in +13 -0
- data/libchdr/deps/zlib-1.2.11/zlib2ansi +152 -0
- data/libchdr/deps/zlib-1.2.11/zutil.c +325 -0
- data/libchdr/deps/zlib-1.2.11/zutil.h +271 -0
- data/libchdr/include/dr_libs/dr_flac.h +12280 -0
- data/libchdr/include/libchdr/bitstream.h +43 -0
- data/libchdr/include/libchdr/cdrom.h +110 -0
- data/libchdr/include/libchdr/chd.h +427 -0
- data/libchdr/include/libchdr/chdconfig.h +10 -0
- data/libchdr/include/libchdr/coretypes.h +60 -0
- data/libchdr/include/libchdr/flac.h +50 -0
- data/libchdr/include/libchdr/huffman.h +90 -0
- data/libchdr/pkg-config.pc.in +10 -0
- data/libchdr/src/libchdr_bitstream.c +125 -0
- data/libchdr/src/libchdr_cdrom.c +415 -0
- data/libchdr/src/libchdr_chd.c +2744 -0
- data/libchdr/src/libchdr_flac.c +302 -0
- data/libchdr/src/libchdr_huffman.c +545 -0
- data/libchdr/src/link.T +5 -0
- data/libchdr/tests/CMakeLists.txt +2 -0
- data/libchdr/tests/benchmark.c +52 -0
- metadata +183 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
/* Sort.c -- Sort functions
|
2
|
+
2014-04-05 : Igor Pavlov : Public domain */
|
3
|
+
|
4
|
+
#include "Precomp.h"
|
5
|
+
|
6
|
+
#include "Sort.h"
|
7
|
+
|
8
|
+
#define HeapSortDown(p, k, size, temp) \
|
9
|
+
{ for (;;) { \
|
10
|
+
size_t s = (k << 1); \
|
11
|
+
if (s > size) break; \
|
12
|
+
if (s < size && p[s + 1] > p[s]) s++; \
|
13
|
+
if (temp >= p[s]) break; \
|
14
|
+
p[k] = p[s]; k = s; \
|
15
|
+
} p[k] = temp; }
|
16
|
+
|
17
|
+
void HeapSort(UInt32 *p, size_t size)
|
18
|
+
{
|
19
|
+
if (size <= 1)
|
20
|
+
return;
|
21
|
+
p--;
|
22
|
+
{
|
23
|
+
size_t i = size / 2;
|
24
|
+
do
|
25
|
+
{
|
26
|
+
UInt32 temp = p[i];
|
27
|
+
size_t k = i;
|
28
|
+
HeapSortDown(p, k, size, temp)
|
29
|
+
}
|
30
|
+
while (--i != 0);
|
31
|
+
}
|
32
|
+
/*
|
33
|
+
do
|
34
|
+
{
|
35
|
+
size_t k = 1;
|
36
|
+
UInt32 temp = p[size];
|
37
|
+
p[size--] = p[1];
|
38
|
+
HeapSortDown(p, k, size, temp)
|
39
|
+
}
|
40
|
+
while (size > 1);
|
41
|
+
*/
|
42
|
+
while (size > 3)
|
43
|
+
{
|
44
|
+
UInt32 temp = p[size];
|
45
|
+
size_t k = (p[3] > p[2]) ? 3 : 2;
|
46
|
+
p[size--] = p[1];
|
47
|
+
p[1] = p[k];
|
48
|
+
HeapSortDown(p, k, size, temp)
|
49
|
+
}
|
50
|
+
{
|
51
|
+
UInt32 temp = p[size];
|
52
|
+
p[size] = p[1];
|
53
|
+
if (size > 2 && p[2] < temp)
|
54
|
+
{
|
55
|
+
p[1] = p[2];
|
56
|
+
p[2] = temp;
|
57
|
+
}
|
58
|
+
else
|
59
|
+
p[1] = temp;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
void HeapSort64(UInt64 *p, size_t size)
|
64
|
+
{
|
65
|
+
if (size <= 1)
|
66
|
+
return;
|
67
|
+
p--;
|
68
|
+
{
|
69
|
+
size_t i = size / 2;
|
70
|
+
do
|
71
|
+
{
|
72
|
+
UInt64 temp = p[i];
|
73
|
+
size_t k = i;
|
74
|
+
HeapSortDown(p, k, size, temp)
|
75
|
+
}
|
76
|
+
while (--i != 0);
|
77
|
+
}
|
78
|
+
/*
|
79
|
+
do
|
80
|
+
{
|
81
|
+
size_t k = 1;
|
82
|
+
UInt64 temp = p[size];
|
83
|
+
p[size--] = p[1];
|
84
|
+
HeapSortDown(p, k, size, temp)
|
85
|
+
}
|
86
|
+
while (size > 1);
|
87
|
+
*/
|
88
|
+
while (size > 3)
|
89
|
+
{
|
90
|
+
UInt64 temp = p[size];
|
91
|
+
size_t k = (p[3] > p[2]) ? 3 : 2;
|
92
|
+
p[size--] = p[1];
|
93
|
+
p[1] = p[k];
|
94
|
+
HeapSortDown(p, k, size, temp)
|
95
|
+
}
|
96
|
+
{
|
97
|
+
UInt64 temp = p[size];
|
98
|
+
p[size] = p[1];
|
99
|
+
if (size > 2 && p[2] < temp)
|
100
|
+
{
|
101
|
+
p[1] = p[2];
|
102
|
+
p[2] = temp;
|
103
|
+
}
|
104
|
+
else
|
105
|
+
p[1] = temp;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
/*
|
110
|
+
#define HeapSortRefDown(p, vals, n, size, temp) \
|
111
|
+
{ size_t k = n; UInt32 val = vals[temp]; for (;;) { \
|
112
|
+
size_t s = (k << 1); \
|
113
|
+
if (s > size) break; \
|
114
|
+
if (s < size && vals[p[s + 1]] > vals[p[s]]) s++; \
|
115
|
+
if (val >= vals[p[s]]) break; \
|
116
|
+
p[k] = p[s]; k = s; \
|
117
|
+
} p[k] = temp; }
|
118
|
+
|
119
|
+
void HeapSortRef(UInt32 *p, UInt32 *vals, size_t size)
|
120
|
+
{
|
121
|
+
if (size <= 1)
|
122
|
+
return;
|
123
|
+
p--;
|
124
|
+
{
|
125
|
+
size_t i = size / 2;
|
126
|
+
do
|
127
|
+
{
|
128
|
+
UInt32 temp = p[i];
|
129
|
+
HeapSortRefDown(p, vals, i, size, temp);
|
130
|
+
}
|
131
|
+
while (--i != 0);
|
132
|
+
}
|
133
|
+
do
|
134
|
+
{
|
135
|
+
UInt32 temp = p[size];
|
136
|
+
p[size--] = p[1];
|
137
|
+
HeapSortRefDown(p, vals, 1, size, temp);
|
138
|
+
}
|
139
|
+
while (size > 1);
|
140
|
+
}
|
141
|
+
*/
|
@@ -0,0 +1,29 @@
|
|
1
|
+
add_library(zlib STATIC
|
2
|
+
zconf.h
|
3
|
+
zlib.h
|
4
|
+
adler32.c
|
5
|
+
compress.c
|
6
|
+
crc32.c
|
7
|
+
crc32.h
|
8
|
+
deflate.c
|
9
|
+
deflate.h
|
10
|
+
gzguts.h
|
11
|
+
infback.c
|
12
|
+
inffast.c
|
13
|
+
inffast.h
|
14
|
+
inffixed.h
|
15
|
+
inflate.c
|
16
|
+
inflate.h
|
17
|
+
inftrees.c
|
18
|
+
inftrees.h
|
19
|
+
trees.c
|
20
|
+
trees.h
|
21
|
+
uncompr.c
|
22
|
+
zutil.c
|
23
|
+
zutil.h
|
24
|
+
)
|
25
|
+
|
26
|
+
target_include_directories(zlib PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
|
27
|
+
target_include_directories(zlib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
|
28
|
+
|
29
|
+
set_target_properties(zlib PROPERTIES POSITION_INDEPENDENT_CODE ON)
|