1 | /* |
1 | /* |
2 | * Copyright (c) 2000-2002 Marc Alexander Lehmann <pcg@goof.com> |
2 | * Copyright (c) 2000-2003 Marc Alexander Lehmann <pcg@goof.com> |
3 | * |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without modifica- |
4 | * Redistribution and use in source and binary forms, with or without modifica- |
5 | * tion, are permitted provided that the following conditions are met: |
5 | * tion, are permitted provided that the following conditions are met: |
6 | * |
6 | * |
7 | * 1. Redistributions of source code must retain the above copyright notice, |
7 | * 1. Redistributions of source code must retain the above copyright notice, |
… | |
… | |
66 | * |
66 | * |
67 | */ |
67 | */ |
68 | |
68 | |
69 | unsigned int |
69 | unsigned int |
70 | lzf_compress (const void *const in_data, unsigned int in_len, |
70 | lzf_compress (const void *const in_data, unsigned int in_len, |
71 | void *out_data, unsigned int out_len) |
71 | void *out_data, unsigned int out_len |
|
|
72 | #if !LZF_STATE_ARG |
|
|
73 | , LZF_STATE *htab |
|
|
74 | #endif |
|
|
75 | ) |
72 | { |
76 | { |
73 | const u8 *htab[HSIZE]; |
77 | #if LZF_STATE_ARG |
|
|
78 | LZF_STATE htab; |
|
|
79 | #endif |
74 | const u8 **hslot; |
80 | const u8 **hslot; |
75 | const u8 *ip = in_data; |
81 | const u8 *ip = (const u8 *)in_data; |
76 | u8 *op = out_data; |
82 | u8 *op = (u8 *)out_data; |
77 | const u8 *in_end = ip + in_len; |
83 | const u8 *in_end = ip + in_len; |
78 | u8 *out_end = op + out_len; |
84 | u8 *out_end = op + out_len; |
79 | const u8 *ref; |
85 | const u8 *ref; |
80 | |
86 | |
81 | unsigned int hval = FRST (ip); |
87 | unsigned int hval = FRST (ip); |