1 /*
2 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
5
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
8
9
10 /*
11 * Copyright (c) 1986 Regents of the University of California.
12 * All rights reserved. The Berkeley software License Agreement
13 * specifies the terms and conditions for redistribution.
14 */
15
16 #pragma ident "%Z%%M% %I% %E% SMI"
17
18 /*
19 * Compress - data compression program
20 */
21 #define min(a, b) ((a > b) ? b : a)
22
23 /*
24 * machine variants which require cc -Dmachine: pdp11, z8000, pcxt
25 */
26
27 /*
28 * Set USERMEM to the maximum amount of physical user memory available
29 * in bytes. USERMEM is used to determine the maximum BITS that can be used
30 * for compression.
31 *
32 * SACREDMEM is the amount of physical memory saved for others; compress
33 * will hog the rest.
34 */
35 #ifndef SACREDMEM
36 #define SACREDMEM 0
1786 i = hsize - 16;
1787 do { /* might use Sys V memset(3) here */
1788 *(htab_p-16) = m1;
1789 *(htab_p-15) = m1;
1790 *(htab_p-14) = m1;
1791 *(htab_p-13) = m1;
1792 *(htab_p-12) = m1;
1793 *(htab_p-11) = m1;
1794 *(htab_p-10) = m1;
1795 *(htab_p-9) = m1;
1796 *(htab_p-8) = m1;
1797 *(htab_p-7) = m1;
1798 *(htab_p-6) = m1;
1799 *(htab_p-5) = m1;
1800 *(htab_p-4) = m1;
1801 *(htab_p-3) = m1;
1802 *(htab_p-2) = m1;
1803 *(htab_p-1) = m1;
1804 htab_p -= 16;
1805 } while ((i -= 16) >= 0);
1806 for (i += 16; i > 0; i--)
1807 *--htab_p = m1;
1808 }
1809
1810 static void
1811 prratio(FILE *stream, count_long num, count_long den)
1812 {
1813 int q; /* store percentage */
1814
1815 q = (int)(10000LL * (count_long)num / (count_long)den);
1816 if (q < 0) {
1817 (void) putc('-', stream);
1818 q = -q;
1819 }
1820 (void) fprintf(stream, "%d%s%02d%%", q / 100,
1821 localeconv()->decimal_point, q % 100);
1822 }
1823
1824 static void
1825 version()
|
1 /*
2 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
5
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
8
9
10 /*
11 * Copyright (c) 1986 Regents of the University of California.
12 * All rights reserved. The Berkeley software License Agreement
13 * specifies the terms and conditions for redistribution.
14 */
15
16 /*
17 * Copyright (c) 2018, Joyent, Inc.
18 */
19
20 /*
21 * Compress - data compression program
22 */
23 #define min(a, b) ((a > b) ? b : a)
24
25 /*
26 * machine variants which require cc -Dmachine: pdp11, z8000, pcxt
27 */
28
29 /*
30 * Set USERMEM to the maximum amount of physical user memory available
31 * in bytes. USERMEM is used to determine the maximum BITS that can be used
32 * for compression.
33 *
34 * SACREDMEM is the amount of physical memory saved for others; compress
35 * will hog the rest.
36 */
37 #ifndef SACREDMEM
38 #define SACREDMEM 0
1788 i = hsize - 16;
1789 do { /* might use Sys V memset(3) here */
1790 *(htab_p-16) = m1;
1791 *(htab_p-15) = m1;
1792 *(htab_p-14) = m1;
1793 *(htab_p-13) = m1;
1794 *(htab_p-12) = m1;
1795 *(htab_p-11) = m1;
1796 *(htab_p-10) = m1;
1797 *(htab_p-9) = m1;
1798 *(htab_p-8) = m1;
1799 *(htab_p-7) = m1;
1800 *(htab_p-6) = m1;
1801 *(htab_p-5) = m1;
1802 *(htab_p-4) = m1;
1803 *(htab_p-3) = m1;
1804 *(htab_p-2) = m1;
1805 *(htab_p-1) = m1;
1806 htab_p -= 16;
1807 } while ((i -= 16) >= 0);
1808
1809 for (i += 16; i > 0; i--)
1810 *--htab_p = m1;
1811 }
1812
1813 static void
1814 prratio(FILE *stream, count_long num, count_long den)
1815 {
1816 int q; /* store percentage */
1817
1818 q = (int)(10000LL * (count_long)num / (count_long)den);
1819 if (q < 0) {
1820 (void) putc('-', stream);
1821 q = -q;
1822 }
1823 (void) fprintf(stream, "%d%s%02d%%", q / 100,
1824 localeconv()->decimal_point, q % 100);
1825 }
1826
1827 static void
1828 version()
|