diff options
Diffstat (limited to 'linden/indra/llcommon/bitpack.cpp')
-rw-r--r-- | linden/indra/llcommon/bitpack.cpp | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/linden/indra/llcommon/bitpack.cpp b/linden/indra/llcommon/bitpack.cpp deleted file mode 100644 index 813e09c..0000000 --- a/linden/indra/llcommon/bitpack.cpp +++ /dev/null | |||
@@ -1,167 +0,0 @@ | |||
1 | /** | ||
2 | * @file bitpack.cpp | ||
3 | * @brief Convert data to packed bit stream | ||
4 | * | ||
5 | * Copyright (c) 2000-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "linden_common.h" | ||
29 | |||
30 | #include "bitpack.h" | ||
31 | |||
32 | #if 0 | ||
33 | #include <stdio.h> | ||
34 | #include <stdlib.h> | ||
35 | #include "stdtypes.h" | ||
36 | |||
37 | U8 gLoad, gUnLoad; | ||
38 | U32 gLoadSize, gUnLoadSize, gTotalBits; | ||
39 | |||
40 | const U32 gMaxDataBits = 8; | ||
41 | |||
42 | ///////////////////////////////////////////////////////////////////////////////////////// | ||
43 | #if 0 | ||
44 | void bit_pack(U8 *outbase, U32 *outptr, U8 *total_data, U32 total_dsize) | ||
45 | { | ||
46 | U32 max_data_bits = gMaxDataBits; | ||
47 | U32 load_size = gLoadSize, total_bits = gTotalBits; | ||
48 | U32 dsize; | ||
49 | |||
50 | U8 data; | ||
51 | U8 load = gLoad; | ||
52 | |||
53 | while (total_dsize > 0) | ||
54 | { | ||
55 | if (total_dsize > max_data_bits) | ||
56 | { | ||
57 | dsize = max_data_bits; | ||
58 | total_dsize -= max_data_bits; | ||
59 | } | ||
60 | else | ||
61 | { | ||
62 | dsize = total_dsize; | ||
63 | total_dsize = 0; | ||
64 | } | ||
65 | |||
66 | data = *total_data++; | ||
67 | |||
68 | data <<= (max_data_bits - dsize); | ||
69 | while (dsize > 0) | ||
70 | { | ||
71 | if (load_size == max_data_bits) | ||
72 | { | ||
73 | *(outbase + (*outptr)++) = load; | ||
74 | load_size = 0; | ||
75 | load = 0x00; | ||
76 | } | ||
77 | load <<= 1; | ||
78 | load |= (data >> (max_data_bits - 1)); | ||
79 | data <<= 1; | ||
80 | load_size++; | ||
81 | total_bits++; | ||
82 | dsize--; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | gLoad = load; | ||
87 | gLoadSize = load_size; | ||
88 | gTotalBits = total_bits; | ||
89 | } | ||
90 | #endif | ||
91 | |||
92 | ///////////////////////////////////////////////////////////////////////////////////////// | ||
93 | |||
94 | void bit_pack_reset() | ||
95 | { | ||
96 | gLoad = 0x0; | ||
97 | gLoadSize = 0; | ||
98 | gTotalBits = 0; | ||
99 | } | ||
100 | |||
101 | ///////////////////////////////////////////////////////////////////////////////////////// | ||
102 | |||
103 | void bit_pack_flush(U8 *outbase, U32 *outptr) | ||
104 | { | ||
105 | if (gLoadSize) | ||
106 | { | ||
107 | gTotalBits += gLoadSize; | ||
108 | gLoad <<= (gMaxDataBits - gLoadSize); | ||
109 | outbase[(*outptr)++] = gLoad; | ||
110 | gLoadSize = 0; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | //////////////////////////////////////////////////////////////////////////////////////// | ||
115 | #if 0 | ||
116 | void bit_unpack(U8 *total_retval, U32 total_dsize, U8 *indata, U32 *inptr) | ||
117 | { | ||
118 | U32 max_data_bits = gMaxDataBits; | ||
119 | U32 unload_size = gUnLoadSize; | ||
120 | U32 dsize; | ||
121 | U8 *retval; | ||
122 | U8 unload = gUnLoad; | ||
123 | |||
124 | while (total_dsize > 0) | ||
125 | { | ||
126 | if (total_dsize > max_data_bits) | ||
127 | { | ||
128 | dsize = max_data_bits; | ||
129 | total_dsize -= max_data_bits; | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | dsize = total_dsize; | ||
134 | total_dsize = 0; | ||
135 | } | ||
136 | |||
137 | retval = total_data++; | ||
138 | *retval = 0x00; | ||
139 | while (dsize > 0) | ||
140 | { | ||
141 | if (unload_size == 0) | ||
142 | { | ||
143 | unload = indata[(*inptr)++]; | ||
144 | unload_size = max_data_bits; | ||
145 | } | ||
146 | *retval <<= 1; | ||
147 | *retval |= (unload >> (max_data_bits - 1)); | ||
148 | unload_size--; | ||
149 | unload <<= 1; | ||
150 | dsize--; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | gUnLoad = unload; | ||
155 | gUnLoadSize = unload_size; | ||
156 | } | ||
157 | #endif | ||
158 | |||
159 | |||
160 | /////////////////////////////////////////////////////////////////////////////////////// | ||
161 | |||
162 | void bit_unpack_reset() | ||
163 | { | ||
164 | gUnLoad = 0; | ||
165 | gUnLoadSize = 0; | ||
166 | } | ||
167 | #endif | ||