LZF in the kernel. As an entropy estimator for now but it's very small, and we could use it for ipcomp, for hibernation, for paging, for core dumps, etc.diff -r1.3 -r1.3.8.1 src/external/bsd/liblzf/dist/lzfP.h
(tls)
--- src/external/bsd/liblzf/dist/lzfP.h 2012/09/16 18:59:27 1.3
+++ src/external/bsd/liblzf/dist/lzfP.h 2014/04/07 01:10:55 1.3.8.1
@@ -27,69 +27,71 @@ | @@ -27,69 +27,71 @@ | |||
27 | * in which case the provisions of the GPL are applicable instead of | 27 | * in which case the provisions of the GPL are applicable instead of | |
28 | * the above. If you wish to allow the use of your version of this file | 28 | * the above. If you wish to allow the use of your version of this file | |
29 | * only under the terms of the GPL and not to allow others to use your | 29 | * only under the terms of the GPL and not to allow others to use your | |
30 | * version of this file under the BSD license, indicate your decision | 30 | * version of this file under the BSD license, indicate your decision | |
31 | * by deleting the provisions above and replace them with the notice | 31 | * by deleting the provisions above and replace them with the notice | |
32 | * and other provisions required by the GPL. If you do not delete the | 32 | * and other provisions required by the GPL. If you do not delete the | |
33 | * provisions above, a recipient may use your version of this file under | 33 | * provisions above, a recipient may use your version of this file under | |
34 | * either the BSD or the GPL. | 34 | * either the BSD or the GPL. | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #ifndef LZFP_h | 37 | #ifndef LZFP_h | |
38 | #define LZFP_h | 38 | #define LZFP_h | |
39 | 39 | |||
40 | #define STANDALONE 1 /* at the moment, this is ok. */ | 40 | #if !defined(_KERNEL) && !defined(_STANDALONE) | |
41 | 41 | #include <sys/types.h> | ||
42 | #ifndef STANDALONE | 42 | #include <inttypes.h> | |
43 | # include "lzf.h" | |||
44 | #endif | 43 | #endif | |
45 | 44 | |||
46 | /* | 45 | /* | |
47 | * Size of hashtable is (1 << HLOG) * sizeof (char *) | 46 | * Size of hashtable is (1 << LZF_HLOG) * sizeof (char *) | |
48 | * decompression is independent of the hash table size | 47 | * decompression is independent of the hash table size | |
49 | * the difference between 15 and 14 is very small | 48 | * the difference between 15 and 14 is very small | |
50 | * for small blocks (and 14 is usually a bit faster). | 49 | * for small blocks (and 14 is usually a bit faster). | |
51 | * For a low-memory/faster configuration, use HLOG == 13; | 50 | * For a low-memory/faster configuration, use LZF_HLOG == 13; | |
52 | * For best compression, use 15 or 16 (or more, up to 23). | 51 | * For best compression, use 15 or 16 (or more, up to 23). | |
53 | */ | 52 | */ | |
54 | #ifndef HLOG | 53 | #ifndef LZF_HLOG | |
55 | # define HLOG 16 | 54 | # define LZF_HLOG 16 | |
56 | #endif | 55 | #endif | |
57 | 56 | |||
58 | /* | 57 | /* | |
59 | * Sacrifice very little compression quality in favour of compression speed. | 58 | * Sacrifice very little compression quality in favour of compression speed. | |
60 | * This gives almost the same compression as the default code, and is | 59 | * This gives almost the same compression as the default code, and is | |
61 | * (very roughly) 15% faster. This is the preferred mode of operation. | 60 | * (very roughly) 15% faster. This is the preferred mode of operation. | |
62 | */ | 61 | */ | |
63 | #ifndef VERY_FAST | 62 | #ifndef VERY_FAST | |
64 | # define VERY_FAST 1 | 63 | # define VERY_FAST 1 | |
65 | #endif | 64 | #endif | |
66 | 65 | |||
67 | /* | 66 | /* | |
68 | * Sacrifice some more compression quality in favour of compression speed. | 67 | * Sacrifice some more compression quality in favour of compression speed. | |
69 | * (roughly 1-2% worse compression for large blocks and | 68 | * (roughly 1-2% worse compression for large blocks and | |
70 | * 9-10% for small, redundant, blocks and >>20% better speed in both cases) | 69 | * 9-10% for small, redundant, blocks and >>20% better speed in both cases) | |
71 | * In short: when in need for speed, enable this for binary data, | 70 | * In short: when in need for speed, enable this for binary data, | |
72 | * possibly disable this for text data. | 71 | * possibly disable this for text data. | |
73 | */ | 72 | */ | |
74 | #ifndef ULTRA_FAST | 73 | #ifndef ULTRA_FAST | |
75 | # define ULTRA_FAST 0 | 74 | # define ULTRA_FAST 0 | |
76 | #endif | 75 | #endif | |
77 | 76 | |||
78 | /* | 77 | /* | |
79 | * Unconditionally aligning does not cost very much, so do it if unsure | 78 | * Unconditionally aligning does not cost very much, so do it if unsure | |
79 | * | |||
80 | * In fact, on modern x86 processors, strict alignment is faster whether | |||
81 | * in 32 or 64 bit mode. | |||
80 | */ | 82 | */ | |
81 | #ifndef STRICT_ALIGN | 83 | #ifndef STRICT_ALIGN | |
82 | # define STRICT_ALIGN !(defined(__i386) || defined (__amd64)) | 84 | # define STRICT_ALIGN 1 /* !(defined(__i386) || defined (__amd64)) */ | |
83 | #endif | 85 | #endif | |
84 | 86 | |||
85 | /* | 87 | /* | |
86 | * You may choose to pre-set the hash table (might be faster on some | 88 | * You may choose to pre-set the hash table (might be faster on some | |
87 | * modern cpus and large (>>64k) blocks, and also makes compression | 89 | * modern cpus and large (>>64k) blocks, and also makes compression | |
88 | * deterministic/repeatable when the configuration otherwise is the same). | 90 | * deterministic/repeatable when the configuration otherwise is the same). | |
89 | */ | 91 | */ | |
90 | #ifndef INIT_HTAB | 92 | #ifndef INIT_HTAB | |
91 | # define INIT_HTAB 0 | 93 | # define INIT_HTAB 0 | |
92 | #endif | 94 | #endif | |
93 | 95 | |||
94 | /* | 96 | /* | |
95 | * Avoid assigning values to errno variable? for some embedding purposes | 97 | * Avoid assigning values to errno variable? for some embedding purposes | |
@@ -114,41 +116,31 @@ | @@ -114,41 +116,31 @@ | |||
114 | * and return EINVAL if the input stream has been corrupted. This | 116 | * and return EINVAL if the input stream has been corrupted. This | |
115 | * only shields against overflowing the input buffer and will not | 117 | * only shields against overflowing the input buffer and will not | |
116 | * detect most corrupted streams. | 118 | * detect most corrupted streams. | |
117 | * This check is not normally noticable on modern hardware | 119 | * This check is not normally noticable on modern hardware | |
118 | * (<1% slowdown), but might slow down older cpus considerably. | 120 | * (<1% slowdown), but might slow down older cpus considerably. | |
119 | */ | 121 | */ | |
120 | #ifndef CHECK_INPUT | 122 | #ifndef CHECK_INPUT | |
121 | # define CHECK_INPUT 1 | 123 | # define CHECK_INPUT 1 | |
122 | #endif | 124 | #endif | |
123 | 125 | |||
124 | /*****************************************************************************/ | 126 | /*****************************************************************************/ | |
125 | /* nothing should be changed below */ | 127 | /* nothing should be changed below */ | |
126 | 128 | |||
127 | typedef unsigned char u8; | 129 | typedef uint8_t u8; | |
128 | 130 | typedef uint16_t u16; | ||
129 | typedef const u8 *LZF_STATE[1 << (HLOG)]; | |||
130 | 131 | |||
131 | #if !STRICT_ALIGN | 132 | #if !defined(_KERNEL) && !defined(STANDALONE) | |
132 | /* for unaligned accesses we need a 16 bit datatype. */ | 133 | typedef const u8 *LZF_STATE[1 << (LZF_HLOG)]; | |
133 | # include <limits.h> | |||
134 | # if USHRT_MAX == 65535 | |||
135 | typedef unsigned short u16; | |||
136 | # elif UINT_MAX == 65535 | |||
137 | typedef unsigned int u16; | |||
138 | # else | |||
139 | # undef STRICT_ALIGN | |||
140 | # define STRICT_ALIGN 1 | |||
141 | # endif | |||
142 | #endif | 134 | #endif | |
143 | 135 | |||
144 | #if ULTRA_FAST | 136 | #if ULTRA_FAST | |
145 | # if defined(VERY_FAST) | 137 | # if defined(VERY_FAST) | |
146 | # undef VERY_FAST | 138 | # undef VERY_FAST | |
147 | # endif | 139 | # endif | |
148 | #endif | 140 | #endif | |
149 | 141 | |||
150 | #if INIT_HTAB | 142 | #if INIT_HTAB | |
151 | # ifdef __cplusplus | 143 | # ifdef __cplusplus | |
152 | # include <cstring> | 144 | # include <cstring> | |
153 | # else | 145 | # else | |
154 | # include <string.h> | 146 | # include <string.h> |
--- src/external/bsd/liblzf/dist/lzf_c.c 2012/09/16 18:59:27 1.4
+++ src/external/bsd/liblzf/dist/lzf_c.c 2014/04/07 01:10:55 1.4.8.1
@@ -24,50 +24,55 @@ | @@ -24,50 +24,55 @@ | |||
24 | * | 24 | * | |
25 | * Alternatively, the contents of this file may be used under the terms of | 25 | * Alternatively, the contents of this file may be used under the terms of | |
26 | * the GNU General Public License ("GPL") version 2 or any later version, | 26 | * the GNU General Public License ("GPL") version 2 or any later version, | |
27 | * in which case the provisions of the GPL are applicable instead of | 27 | * in which case the provisions of the GPL are applicable instead of | |
28 | * the above. If you wish to allow the use of your version of this file | 28 | * the above. If you wish to allow the use of your version of this file | |
29 | * only under the terms of the GPL and not to allow others to use your | 29 | * only under the terms of the GPL and not to allow others to use your | |
30 | * version of this file under the BSD license, indicate your decision | 30 | * version of this file under the BSD license, indicate your decision | |
31 | * by deleting the provisions above and replace them with the notice | 31 | * by deleting the provisions above and replace them with the notice | |
32 | * and other provisions required by the GPL. If you do not delete the | 32 | * and other provisions required by the GPL. If you do not delete the | |
33 | * provisions above, a recipient may use your version of this file under | 33 | * provisions above, a recipient may use your version of this file under | |
34 | * either the BSD or the GPL. | 34 | * either the BSD or the GPL. | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #if defined(_KERNEL) || defined (_STANDALONE) | |||
38 | #include <lib/libkern/libkern.h> | |||
39 | #include "lzfP.h" | |||
40 | #else | |||
37 | #include "lzf.h" | 41 | #include "lzf.h" | |
42 | #endif | |||
38 | 43 | |||
39 | #define HSIZE (1 << (HLOG)) | 44 | #define HSIZE (1 << (LZF_HLOG)) | |
40 | 45 | |||
41 | /* | 46 | /* | |
42 | * don't play with this unless you benchmark! | 47 | * don't play with this unless you benchmark! | |
43 | * decompression is not dependent on the hash function | 48 | * decompression is not dependent on the hash function | |
44 | * the hashing function might seem strange, just believe me | 49 | * the hashing function might seem strange, just believe me | |
45 | * it works ;) | 50 | * it works ;) | |
46 | */ | 51 | */ | |
47 | #ifndef FRST | 52 | #ifndef FRST | |
48 | # define FRST(p) (((p[0]) << 8) | p[1]) | 53 | # define FRST(p) (((p[0]) << 8) | p[1]) | |
49 | # define NEXT(v,p) (((v) << 8) | p[2]) | 54 | # define NEXT(v,p) (((v) << 8) | p[2]) | |
50 | # if ULTRA_FAST | 55 | # if ULTRA_FAST | |
51 | # define IDX(h) ((( h >> (3*8 - HLOG)) - h ) & (HSIZE - 1)) | 56 | # define IDX(h) ((( h >> (3*8 - LZF_HLOG)) - h ) & (HSIZE - 1)) | |
52 | # elif VERY_FAST | 57 | # elif VERY_FAST | |
53 | # define IDX(h) ((( h >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) | 58 | # define IDX(h) ((( h >> (3*8 - LZF_HLOG)) - h*5) & (HSIZE - 1)) | |
54 | # else | 59 | # else | |
55 | # define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1)) | 60 | # define IDX(h) ((((h ^ (h << 5)) >> (3*8 - LZF_HLOG)) - h*5) & (HSIZE - 1)) | |
56 | # endif | 61 | # endif | |
57 | #endif | 62 | #endif | |
58 | /* | 63 | /* | |
59 | * IDX works because it is very similar to a multiplicative hash, e.g. | 64 | * IDX works because it is very similar to a multiplicative hash, e.g. | |
60 | * ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1)) | 65 | * ((h * 57321 >> (3*8 - LZF_HLOG)) & (HSIZE - 1)) | |
61 | * the latter is also quite fast on newer CPUs, and compresses similarly. | 66 | * the latter is also quite fast on newer CPUs, and compresses similarly. | |
62 | * | 67 | * | |
63 | * the next one is also quite good, albeit slow ;) | 68 | * the next one is also quite good, albeit slow ;) | |
64 | * (int)(cos(h & 0xffffff) * 1e6) | 69 | * (int)(cos(h & 0xffffff) * 1e6) | |
65 | */ | 70 | */ | |
66 | 71 | |||
67 | #if 0 | 72 | #if 0 | |
68 | /* original lzv-like hash function, much worse and thus slower */ | 73 | /* original lzv-like hash function, much worse and thus slower */ | |
69 | # define FRST(p) (p[0] << 5) ^ p[1] | 74 | # define FRST(p) (p[0] << 5) ^ p[1] | |
70 | # define NEXT(v,p) ((v) << 5) ^ p[2] | 75 | # define NEXT(v,p) ((v) << 5) ^ p[2] | |
71 | # define IDX(h) ((h) & (HSIZE - 1)) | 76 | # define IDX(h) ((h) & (HSIZE - 1)) | |
72 | #endif | 77 | #endif | |
73 | 78 | |||
@@ -137,27 +142,27 @@ lzf_compress_r (const void *const in_dat | @@ -137,27 +142,27 @@ lzf_compress_r (const void *const in_dat | |||
137 | hval = FRST (ip); | 142 | hval = FRST (ip); | |
138 | while (ip < in_end - 2) | 143 | while (ip < in_end - 2) | |
139 | { | 144 | { | |
140 | hval = NEXT (hval, ip); | 145 | hval = NEXT (hval, ip); | |
141 | hslot = htab + IDX (hval); | 146 | hslot = htab + IDX (hval); | |
142 | ref = *hslot; *hslot = ip; | 147 | ref = *hslot; *hslot = ip; | |
143 | 148 | |||
144 | if (/*CONSTCOND*/1 | 149 | if (/*CONSTCOND*/1 | |
145 | #if INIT_HTAB | 150 | #if INIT_HTAB | |
146 | && ref < ip /* the next test will actually take care of this, but this is faster */ | 151 | && ref < ip /* the next test will actually take care of this, but this is faster */ | |
147 | #endif | 152 | #endif | |
148 | && (off = ip - ref - 1) < MAX_OFF | 153 | && (off = ip - ref - 1) < MAX_OFF | |
149 | && ip + 4 < in_end | 154 | && ip + 4 < in_end | |
150 | && ref > (u8 *)in_data | 155 | && ref > (const u8 *)in_data | |
151 | #if STRICT_ALIGN | 156 | #if STRICT_ALIGN | |
152 | && ref[0] == ip[0] | 157 | && ref[0] == ip[0] | |
153 | && ref[1] == ip[1] | 158 | && ref[1] == ip[1] | |
154 | && ref[2] == ip[2] | 159 | && ref[2] == ip[2] | |
155 | #else | 160 | #else | |
156 | && *(const u16 *)(const void *)ref == *(const u16 *)(const void *)ip | 161 | && *(const u16 *)(const void *)ref == *(const u16 *)(const void *)ip | |
157 | && ref[2] == ip[2] | 162 | && ref[2] == ip[2] | |
158 | #endif | 163 | #endif | |
159 | ) | 164 | ) | |
160 | { | 165 | { | |
161 | /* match found at *ref++ */ | 166 | /* match found at *ref++ */ | |
162 | unsigned int len = 2; | 167 | unsigned int len = 2; | |
163 | unsigned int maxlen = (unsigned)(in_end - ip) - len; | 168 | unsigned int maxlen = (unsigned)(in_end - ip) - len; |
--- src/external/bsd/liblzf/dist/lzf_d.c 2011/04/05 06:24:42 1.3
+++ src/external/bsd/liblzf/dist/lzf_d.c 2014/04/07 01:10:55 1.3.22.1
@@ -24,33 +24,43 @@ | @@ -24,33 +24,43 @@ | |||
24 | * | 24 | * | |
25 | * Alternatively, the contents of this file may be used under the terms of | 25 | * Alternatively, the contents of this file may be used under the terms of | |
26 | * the GNU General Public License ("GPL") version 2 or any later version, | 26 | * the GNU General Public License ("GPL") version 2 or any later version, | |
27 | * in which case the provisions of the GPL are applicable instead of | 27 | * in which case the provisions of the GPL are applicable instead of | |
28 | * the above. If you wish to allow the use of your version of this file | 28 | * the above. If you wish to allow the use of your version of this file | |
29 | * only under the terms of the GPL and not to allow others to use your | 29 | * only under the terms of the GPL and not to allow others to use your | |
30 | * version of this file under the BSD license, indicate your decision | 30 | * version of this file under the BSD license, indicate your decision | |
31 | * by deleting the provisions above and replace them with the notice | 31 | * by deleting the provisions above and replace them with the notice | |
32 | * and other provisions required by the GPL. If you do not delete the | 32 | * and other provisions required by the GPL. If you do not delete the | |
33 | * provisions above, a recipient may use your version of this file under | 33 | * provisions above, a recipient may use your version of this file under | |
34 | * either the BSD or the GPL. | 34 | * either the BSD or the GPL. | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #if defined(_KERNEL) || defined (_STANDALONE) | |||
38 | #include <lib/libkern/libkern.h> | |||
39 | #include <sys/systm.h> | |||
40 | #include "lzfP.h" | |||
41 | #else | |||
37 | #include "lzf.h" | 42 | #include "lzf.h" | |
43 | #endif | |||
38 | 44 | |||
39 | #if AVOID_ERRNO | 45 | #ifdef _KERNEL | |
40 | # define SET_ERRNO(n) | 46 | # define SET_ERRNO(n) panic("lzf decompression failure: %s", #n) | |
41 | #else | 47 | #else | |
42 | # include <errno.h> | 48 | # ifdef AVOID_ERRNO | |
43 | # define SET_ERRNO(n) errno = (n) | 49 | # define SET_ERRNO(n) | |
50 | # else | |||
51 | # include <errno.h> | |||
52 | # define SET_ERRNO(n) errno = (n) | |||
53 | # endif | |||
44 | #endif | 54 | #endif | |
45 | 55 | |||
46 | #if (__i386 || __amd64) && __GNUC__ >= 3 | 56 | #if (__i386 || __amd64) && __GNUC__ >= 3 | |
47 | # define lzf_movsb(dst, src, len) \ | 57 | # define lzf_movsb(dst, src, len) \ | |
48 | asm ("rep movsb" \ | 58 | asm ("rep movsb" \ | |
49 | : "=D" (dst), "=S" (src), "=c" (len) \ | 59 | : "=D" (dst), "=S" (src), "=c" (len) \ | |
50 | : "0" (dst), "1" (src), "2" (len)); | 60 | : "0" (dst), "1" (src), "2" (len)); | |
51 | #endif | 61 | #endif | |
52 | 62 | |||
53 | unsigned int | 63 | unsigned int | |
54 | lzf_decompress (const void *const in_data, unsigned int in_len, | 64 | lzf_decompress (const void *const in_data, unsigned int in_len, | |
55 | void *out_data, unsigned int out_len) | 65 | void *out_data, unsigned int out_len) | |
56 | { | 66 | { |
--- src/sys/lib/libkern/Makefile.libkern 2014/03/12 00:22:53 1.32
+++ src/sys/lib/libkern/Makefile.libkern 2014/04/07 01:10:55 1.32.2.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: Makefile.libkern,v 1.32 2014/03/12 00:22:53 pooka Exp $ | 1 | # $NetBSD: Makefile.libkern,v 1.32.2.1 2014/04/07 01:10:55 tls Exp $ | |
2 | 2 | |||
3 | # | 3 | # | |
4 | # Variable definitions for libkern. | 4 | # Variable definitions for libkern. | |
5 | # | 5 | # | |
6 | # Before including this, you _must_ set | 6 | # Before including this, you _must_ set | |
7 | # KERNDIR: location of sys/lib/libkern | 7 | # KERNDIR: location of sys/lib/libkern | |
8 | # | 8 | # | |
9 | # You *may* set: | 9 | # You *may* set: | |
10 | # LIBKERN_ARCH: architecture subdir to be used | 10 | # LIBKERN_ARCH: architecture subdir to be used | |
11 | # KERNCPPFLAGS: see Makefile.inc | 11 | # KERNCPPFLAGS: see Makefile.inc | |
12 | # KERNMISCCPPFLAGS: see Makefile.inc | 12 | # KERNMISCCPPFLAGS: see Makefile.inc | |
13 | # | 13 | # | |
14 | 14 | |||
@@ -84,26 +84,29 @@ SRCS+= strncat.c strncmp.c strncpy.c | @@ -84,26 +84,29 @@ SRCS+= strncat.c strncmp.c strncpy.c | |||
84 | SRCS+= strcasecmp.c strncasecmp.c | 84 | SRCS+= strcasecmp.c strncasecmp.c | |
85 | 85 | |||
86 | SRCS+= xlat_mbr_fstype.c | 86 | SRCS+= xlat_mbr_fstype.c | |
87 | 87 | |||
88 | SRCS+= heapsort.c ptree.c rb.c | 88 | SRCS+= heapsort.c ptree.c rb.c | |
89 | 89 | |||
90 | # for crypto | 90 | # for crypto | |
91 | SRCS+= explicit_memset.c consttime_memequal.c | 91 | SRCS+= explicit_memset.c consttime_memequal.c | |
92 | 92 | |||
93 | .PATH: ${NETBSDSRCDIR}/common/lib/libc/cdb | 93 | .PATH: ${NETBSDSRCDIR}/common/lib/libc/cdb | |
94 | SRCS+= cdbr.c | 94 | SRCS+= cdbr.c | |
95 | SRCS+= mi_vector_hash.c | 95 | SRCS+= mi_vector_hash.c | |
96 | 96 | |||
97 | .PATH: ${NETBSDSRCDIR}/external/bsd/liblzf/dist | |||
98 | SRCS+= lzf_c.c lzf_d.c | |||
99 | ||||
97 | # Files to clean up | 100 | # Files to clean up | |
98 | CLEANFILES+= lib${LIB}.o lib${LIB}.po | 101 | CLEANFILES+= lib${LIB}.o lib${LIB}.po | |
99 | 102 | |||
100 | # Remove from SRCS the .c files for any .S files added by the MD makefiles, | 103 | # Remove from SRCS the .c files for any .S files added by the MD makefiles, | |
101 | # also remove from SRCS the .c files for the .c files in NO_SRCS. | 104 | # also remove from SRCS the .c files for the .c files in NO_SRCS. | |
102 | # (Unlike libc, we don't worry about lint) | 105 | # (Unlike libc, we don't worry about lint) | |
103 | 106 | |||
104 | .for check_file in ${SRCS:M*.S} ${NO_SRCS} | 107 | .for check_file in ${SRCS:M*.S} ${NO_SRCS} | |
105 | unwanted_file := ${SRCS:M${check_file:.S=.c}} | 108 | unwanted_file := ${SRCS:M${check_file:.S=.c}} | |
106 | .if "${unwanted_file}" != "" | 109 | .if "${unwanted_file}" != "" | |
107 | SRCS := ${SRCS:N${unwanted_file}} | 110 | SRCS := ${SRCS:N${unwanted_file}} | |
108 | .endif | 111 | .endif | |
109 | .endfor | 112 | .endfor |
--- src/sys/lib/libkern/libkern.h 2014/02/27 18:05:07 1.113
+++ src/sys/lib/libkern/libkern.h 2014/04/07 01:10:55 1.113.2.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: libkern.h,v 1.113 2014/02/27 18:05:07 joerg Exp $ */ | 1 | /* $NetBSD: libkern.h,v 1.113.2.1 2014/04/07 01:10:55 tls Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1992, 1993 | 4 | * Copyright (c) 1992, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -369,14 +369,32 @@ uintmax_t strtoumax(const char *, char * | @@ -369,14 +369,32 @@ uintmax_t strtoumax(const char *, char * | |||
369 | int snprintb(char *, size_t, const char *, uint64_t); | 369 | int snprintb(char *, size_t, const char *, uint64_t); | |
370 | int snprintb_m(char *, size_t, const char *, uint64_t, size_t); | 370 | int snprintb_m(char *, size_t, const char *, uint64_t, size_t); | |
371 | int kheapsort(void *, size_t, size_t, int (*)(const void *, const void *), | 371 | int kheapsort(void *, size_t, size_t, int (*)(const void *, const void *), | |
372 | void *); | 372 | void *); | |
373 | uint32_t crc32(uint32_t, const uint8_t *, size_t); | 373 | uint32_t crc32(uint32_t, const uint8_t *, size_t); | |
374 | unsigned int popcount(unsigned int) __constfunc; | 374 | unsigned int popcount(unsigned int) __constfunc; | |
375 | unsigned int popcountl(unsigned long) __constfunc; | 375 | unsigned int popcountl(unsigned long) __constfunc; | |
376 | unsigned int popcountll(unsigned long long) __constfunc; | 376 | unsigned int popcountll(unsigned long long) __constfunc; | |
377 | unsigned int popcount32(uint32_t) __constfunc; | 377 | unsigned int popcount32(uint32_t) __constfunc; | |
378 | unsigned int popcount64(uint64_t) __constfunc; | 378 | unsigned int popcount64(uint64_t) __constfunc; | |
379 | 379 | |||
380 | void *explicit_memset(void *, int, size_t); | 380 | void *explicit_memset(void *, int, size_t); | |
381 | int consttime_memequal(const void *, const void *, size_t); | 381 | int consttime_memequal(const void *, const void *, size_t); | |
382 | ||||
383 | /* | |||
384 | * LZF hashtable/state size: on uncompressible data and on a system with | |||
385 | * a sufficiently large d-cache, a larger table produces a considerable | |||
386 | * speed benefit. On systems with small memory and caches, however... | |||
387 | */ | |||
388 | #if defined(__vax__) || defined(__m68k__) | |||
389 | #define LZF_HLOG 14 | |||
390 | #else | |||
391 | #define LZF_HLOG 15 | |||
392 | #endif | |||
393 | typedef const uint8_t *LZF_STATE[1 << LZF_HLOG]; | |||
394 | ||||
395 | unsigned int lzf_compress_r (const void *const, unsigned int, void *, | |||
396 | unsigned int, LZF_STATE); | |||
397 | unsigned int lzf_decompress (const void *const, unsigned int, void *, | |||
398 | unsigned int); | |||
399 | ||||
382 | #endif /* !_LIB_LIBKERN_LIBKERN_H_ */ | 400 | #endif /* !_LIB_LIBKERN_LIBKERN_H_ */ |