Added SDL_crc32()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj
index bda9dab..a061864 100644
--- a/VisualC/SDL/SDL.vcxproj
+++ b/VisualC/SDL/SDL.vcxproj
@@ -500,6 +500,7 @@
<ClCompile Include="..\..\src\sensor\dummy\SDL_dummysensor.c" />
<ClCompile Include="..\..\src\sensor\SDL_sensor.c" />
<ClCompile Include="..\..\src\sensor\windows\SDL_windowssensor.c" />
+ <ClCompile Include="..\..\src\stdlib\SDL_crc32.c" />
<ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
<ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
<ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index f7e1ab8..c7f1827 100644
--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -3977,6 +3977,15 @@
F3950CD8212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3950CD9212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3950CDA212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ F395BF6525633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
+ F395BF6625633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
+ F395BF6725633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
+ F395BF6825633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
+ F395BF6925633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
+ F395BF6A25633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
+ F395BF6B25633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
+ F395BF6C25633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
+ F395BF6D25633B2400942BFF /* SDL_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = F395BF6425633B2400942BFF /* SDL_crc32.c */; };
F3A4909E2554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */ = {isa = PBXBuildFile; fileRef = F3A4909D2554D38500E92A8B /* SDL_hidapi_ps5.c */; };
F3A4909F2554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */ = {isa = PBXBuildFile; fileRef = F3A4909D2554D38500E92A8B /* SDL_hidapi_ps5.c */; };
F3A490A02554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */ = {isa = PBXBuildFile; fileRef = F3A4909D2554D38500E92A8B /* SDL_hidapi_ps5.c */; };
@@ -4532,6 +4541,7 @@
F37DC5F225350EBC0002E6F7 /* CoreHaptics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreHaptics.framework; path = System/Library/Frameworks/CoreHaptics.framework; sourceTree = SDKROOT; };
F37DC5F425350ECC0002E6F7 /* CoreHaptics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreHaptics.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.0.sdk/System/Library/Frameworks/CoreHaptics.framework; sourceTree = DEVELOPER_DIR; };
F3950CD7212BC88D00F51292 /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor.h; sourceTree = "<group>"; };
+ F395BF6425633B2400942BFF /* SDL_crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_crc32.c; sourceTree = "<group>"; };
F3A4909D2554D38500E92A8B /* SDL_hidapi_ps5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_ps5.c; sourceTree = "<group>"; };
F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = "<group>"; };
@@ -5630,6 +5640,7 @@
A7D8A8D223E2514000DCD162 /* stdlib */ = {
isa = PBXGroup;
children = (
+ F395BF6425633B2400942BFF /* SDL_crc32.c */,
A7D8A8D423E2514000DCD162 /* SDL_getenv.c */,
A7D8A8D323E2514000DCD162 /* SDL_iconv.c */,
A7D8A8D923E2514000DCD162 /* SDL_malloc.c */,
@@ -8469,6 +8480,7 @@
A75FCDE923E25AB700529352 /* SDL_drawline.c in Sources */,
A75FCDEA23E25AB700529352 /* SDL_yuv.c in Sources */,
A75FCDEB23E25AB700529352 /* SDL_sysfilesystem.m in Sources */,
+ F395BF6C25633B2400942BFF /* SDL_crc32.c in Sources */,
F3A490A52554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */,
A75FCDEC23E25AB700529352 /* e_pow.c in Sources */,
A75FCDED23E25AB700529352 /* SDL_systls.c in Sources */,
@@ -8669,6 +8681,7 @@
A75FCFA223E25AC700529352 /* SDL_drawline.c in Sources */,
A75FCFA323E25AC700529352 /* SDL_yuv.c in Sources */,
A75FCFA423E25AC700529352 /* SDL_sysfilesystem.m in Sources */,
+ F395BF6D25633B2400942BFF /* SDL_crc32.c in Sources */,
F3A490A62554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */,
A75FCFA523E25AC700529352 /* e_pow.c in Sources */,
A75FCFA623E25AC700529352 /* SDL_systls.c in Sources */,
@@ -9032,6 +9045,7 @@
A769B1F923E259AE00872273 /* SDL_joystick.c in Sources */,
A769B1FA23E259AE00872273 /* SDL_render_gles2.c in Sources */,
A769B1FB23E259AE00872273 /* SDL_surface.c in Sources */,
+ F395BF6A25633B2400942BFF /* SDL_crc32.c in Sources */,
A769B1FC23E259AE00872273 /* SDL_hidapi_xboxone.c in Sources */,
A769B1FD23E259AE00872273 /* SDL_blit_auto.c in Sources */,
A769B1FE23E259AE00872273 /* SDL_x11keyboard.c in Sources */,
@@ -9094,6 +9108,7 @@
A7D8B9E423E2514400DCD162 /* SDL_drawline.c in Sources */,
A7D8AE7D23E2514100DCD162 /* SDL_yuv.c in Sources */,
A7D8B63023E2514300DCD162 /* SDL_sysfilesystem.m in Sources */,
+ F395BF6625633B2400942BFF /* SDL_crc32.c in Sources */,
A7D8BAC823E2514500DCD162 /* e_pow.c in Sources */,
A7D8B41D23E2514300DCD162 /* SDL_systls.c in Sources */,
A7D8AD2A23E2514100DCD162 /* SDL_vulkan_utils.c in Sources */,
@@ -9294,6 +9309,7 @@
A7D8B9E523E2514400DCD162 /* SDL_drawline.c in Sources */,
A7D8AE7E23E2514100DCD162 /* SDL_yuv.c in Sources */,
A7D8B63123E2514300DCD162 /* SDL_sysfilesystem.m in Sources */,
+ F395BF6725633B2400942BFF /* SDL_crc32.c in Sources */,
A7D8BAC923E2514500DCD162 /* e_pow.c in Sources */,
A7D8B41E23E2514300DCD162 /* SDL_systls.c in Sources */,
A7D8AD2B23E2514100DCD162 /* SDL_vulkan_utils.c in Sources */,
@@ -9633,6 +9649,7 @@
A7D8B4E023E2514300DCD162 /* SDL_joystick.c in Sources */,
A7D8BA4D23E2514400DCD162 /* SDL_render_gles2.c in Sources */,
A7D8AC3123E2514100DCD162 /* SDL_surface.c in Sources */,
+ F395BF6925633B2400942BFF /* SDL_crc32.c in Sources */,
A7D8B54F23E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */,
A7D8AD2723E2514100DCD162 /* SDL_blit_auto.c in Sources */,
A7D8B1AA23E2514200DCD162 /* SDL_x11keyboard.c in Sources */,
@@ -9764,6 +9781,7 @@
A7D8BACD23E2514500DCD162 /* e_atan2.c in Sources */,
A7D8BA8B23E2514400DCD162 /* s_sin.c in Sources */,
A7D8BBEB23E2574800DCD162 /* SDL_uikitwindow.m in Sources */,
+ F395BF6525633B2400942BFF /* SDL_crc32.c in Sources */,
A7D8B5E723E2514300DCD162 /* SDL_power.c in Sources */,
A7D8AED623E2514100DCD162 /* SDL_cocoakeyboard.m in Sources */,
A7D8AB1623E2514100DCD162 /* SDL_dynapi.c in Sources */,
@@ -9963,6 +9981,7 @@
A7D8B5EA23E2514300DCD162 /* SDL_power.c in Sources */,
A7D8AED923E2514100DCD162 /* SDL_cocoakeyboard.m in Sources */,
A7D8AB1923E2514100DCD162 /* SDL_dynapi.c in Sources */,
+ F395BF6825633B2400942BFF /* SDL_crc32.c in Sources */,
A7D8BA8823E2514400DCD162 /* SDL_shaders_gl.c in Sources */,
A7D8BAF423E2514500DCD162 /* e_log.c in Sources */,
A7D8AED323E2514100DCD162 /* SDL_cocoamessagebox.m in Sources */,
@@ -10162,6 +10181,7 @@
A7D8BA9023E2514400DCD162 /* s_sin.c in Sources */,
A7D8B5EC23E2514300DCD162 /* SDL_power.c in Sources */,
A7D8AEDB23E2514100DCD162 /* SDL_cocoakeyboard.m in Sources */,
+ F395BF6B25633B2400942BFF /* SDL_crc32.c in Sources */,
A7D8AB1B23E2514100DCD162 /* SDL_dynapi.c in Sources */,
A7D8BA8A23E2514400DCD162 /* SDL_shaders_gl.c in Sources */,
A7D8BAF623E2514500DCD162 /* e_log.c in Sources */,
diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h
index 97e187f..5798a05 100644
--- a/include/SDL_stdinc.h
+++ b/include/SDL_stdinc.h
@@ -417,6 +417,8 @@ extern DECLSPEC int SDLCALL SDL_islower(int x);
extern DECLSPEC int SDLCALL SDL_toupper(int x);
extern DECLSPEC int SDLCALL SDL_tolower(int x);
+extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len);
+
extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 9f2ec44..8532a36 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -779,3 +779,4 @@
#define SDL_GameControllerGetNumTouchpads SDL_GameControllerGetNumTouchpads_REAL
#define SDL_GameControllerGetNumTouchpadFingers SDL_GameControllerGetNumTouchpadFingers_REAL
#define SDL_GameControllerGetTouchpadFinger SDL_GameControllerGetTouchpadFinger_REAL
+#define SDL_crc32 SDL_crc32_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index a7584c0..c165f8b 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -840,3 +840,4 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasButton,(SDL_GameController *a, SDL
SDL_DYNAPI_PROC(int,SDL_GameControllerGetNumTouchpads,(SDL_GameController *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GameControllerGetNumTouchpadFingers,(SDL_GameController *a, int b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GameControllerGetTouchpadFinger,(SDL_GameController *a, int b, int c, Uint8 *d, float *e, float *f, float *g),(a,b,c,d,e,f,g),return)
+SDL_DYNAPI_PROC(Uint32,SDL_crc32,(Uint32 a, const void *b, size_t c),(a,b,c),return)
diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c
index af5bf51..a00343e 100644
--- a/src/joystick/android/SDL_sysjoystick.c
+++ b/src/joystick/android/SDL_sysjoystick.c
@@ -70,28 +70,6 @@ static SDL_joylist_item *SDL_joylist_tail = NULL;
static int numjoysticks = 0;
-/* Public domain CRC implementation adapted from:
- http://home.thep.lu.se/~bjorn/crc/crc32_simple.c
-*/
-static Uint32 crc32_for_byte(Uint32 r)
-{
- int i;
- for(i = 0; i < 8; ++i) {
- r = (r & 1? 0: (Uint32)0xEDB88320L) ^ r >> 1;
- }
- return r ^ (Uint32)0xFF000000L;
-}
-
-static Uint32 crc32(const void *data, size_t count)
-{
- Uint32 crc = 0;
- int i;
- for(i = 0; i < count; ++i) {
- crc = crc32_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8;
- }
- return crc;
-}
-
/* Function to convert Android keyCodes into SDL ones.
* This code manipulation is done to get a sequential list of codes.
* FIXME: This is only suited for the case where we use a fixed number of buttons determined by ANDROID_MAX_NBUTTONS
@@ -391,7 +369,8 @@ Android_AddJoystick(int device_id, const char *name, const char *desc, int vendo
*guid16++ = SDL_SwapLE16(product_id);
*guid16++ = 0;
} else {
- Uint32 crc = crc32(desc, SDL_strlen(desc));
+ Uint32 crc = 0;
+ SDL_crc32(crc, desc, SDL_strlen(desc));
SDL_memcpy(guid16, desc, SDL_min(2*sizeof(*guid16), SDL_strlen(desc)));
guid16 += 2;
*(Uint32 *)guid16 = SDL_SwapLE32(crc);
diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c
index 515d88d..529bba7 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps4.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps4.c
@@ -260,8 +260,8 @@ HIDAPI_DriverPS4_UpdateEffects(SDL_HIDAPI_Device *device)
/* Bluetooth reports need a CRC at the end of the packet (at least on Linux) */
Uint8 ubHdr = 0xA2; /* hidp header is part of the CRC calculation */
Uint32 unCRC;
- unCRC = crc32(0, &ubHdr, 1);
- unCRC = crc32(unCRC, data, (Uint32)(report_size - sizeof(unCRC)));
+ unCRC = SDL_crc32(0, &ubHdr, 1);
+ unCRC = SDL_crc32(unCRC, data, (size_t)(report_size - sizeof(unCRC)));
SDL_memcpy(&data[report_size - sizeof(unCRC)], &unCRC, sizeof(unCRC));
}
diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index ee6a550..d16d8d6 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -236,8 +236,8 @@ HIDAPI_DriverPS5_UpdateEffects(SDL_HIDAPI_Device *device)
/* Bluetooth reports need a CRC at the end of the packet (at least on Linux) */
Uint8 ubHdr = 0xA2; /* hidp header is part of the CRC calculation */
Uint32 unCRC;
- unCRC = crc32(0, &ubHdr, 1);
- unCRC = crc32(unCRC, data, (Uint32)(report_size - sizeof(unCRC)));
+ unCRC = SDL_crc32(0, &ubHdr, 1);
+ unCRC = SDL_crc32(unCRC, data, (size_t)(report_size - sizeof(unCRC)));
SDL_memcpy(&data[report_size - sizeof(unCRC)], &unCRC, sizeof(unCRC));
}
diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c
index 1d819d9..c732cba 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick.c
+++ b/src/joystick/hidapi/SDL_hidapijoystick.c
@@ -390,27 +390,6 @@ HIDAPI_ShutdownDiscovery()
#endif
}
-/* Public domain CRC implementation adapted from:
- http://home.thep.lu.se/~bjorn/crc/crc32_simple.c
-*/
-static Uint32 crc32_for_byte(Uint32 r)
-{
- int i;
- for(i = 0; i < 8; ++i) {
- r = (r & 1? 0: (Uint32)0xEDB88320L) ^ r >> 1;
- }
- return r ^ (Uint32)0xFF000000L;
-}
-
-Uint32 crc32(Uint32 crc, const void *data, int count)
-{
- int i;
- for(i = 0; i < count; ++i) {
- crc = crc32_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8;
- }
- return crc;
-}
-
void
HIDAPI_DumpPacket(const char *prefix, Uint8 *data, int size)
{
diff --git a/src/joystick/hidapi/SDL_hidapijoystick_c.h b/src/joystick/hidapi/SDL_hidapijoystick_c.h
index 498c08f..4ea3f60 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick_c.h
+++ b/src/joystick/hidapi/SDL_hidapijoystick_c.h
@@ -127,8 +127,6 @@ extern void HIDAPI_JoystickDisconnected(SDL_HIDAPI_Device *device, SDL_JoystickI
extern void HIDAPI_DumpPacket(const char *prefix, Uint8 *data, int size);
-Uint32 crc32(Uint32 crc, const void *data, int count);
-
#endif /* SDL_JOYSTICK_HIDAPI_H */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/stdlib/SDL_crc32.c b/src/stdlib/SDL_crc32.c
new file mode 100644
index 0000000..5b9f5d6
--- /dev/null
+++ b/src/stdlib/SDL_crc32.c
@@ -0,0 +1,52 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#include "SDL_stdinc.h"
+
+
+/* Public domain CRC implementation adapted from:
+ http://home.thep.lu.se/~bjorn/crc/crc32_simple.c
+*/
+/* NOTE: DO NOT CHANGE THIS ALGORITHM
+ There is code that relies on this in the joystick code
+*/
+
+static Uint32 crc32_for_byte(Uint32 r)
+{
+ int i;
+ for(i = 0; i < 8; ++i) {
+ r = (r & 1? 0: (Uint32)0xEDB88320L) ^ r >> 1;
+ }
+ return r ^ (Uint32)0xFF000000L;
+}
+
+Uint32 SDL_crc32(Uint32 crc, const void *data, size_t len)
+{
+ /* As an optimization we can precalculate a 256 entry table for each byte */
+ size_t i;
+ for(i = 0; i < len; ++i) {
+ crc = crc32_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8;
+ }
+ return crc;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */