fix up compress.h

so that it can be used with c++ more conveniently
This commit is contained in:
devinacker 2013-10-26 14:25:23 -04:00
parent cfb89888c1
commit e8fb851b50
4 changed files with 35 additions and 24 deletions

View file

@ -16,6 +16,29 @@
#define debug(...)
#endif
// compression method values for backref_t and rle_t
typedef enum {
rle_8 = 0,
rle_16 = 1,
rle_seq = 2,
lz_norm = 0,
lz_rot = 1,
lz_rev = 2
} method_e;
// used to store and compare backref candidates
typedef struct {
uint16_t offset, size;
method_e method;
} backref_t;
// used to store RLE candidates
typedef struct {
uint16_t size, data;
method_e method;
} rle_t;
uint8_t rotate (uint8_t);
rle_t rle_check (uint8_t*, uint8_t*, uint32_t, int);
backref_t ref_search (uint8_t*, uint8_t*, uint32_t, int);

View file

@ -9,40 +9,26 @@
#ifndef _COMPRESS_H
#define _COMPRESS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define DATA_SIZE 65536
#define RUN_SIZE 32
#define LONG_RUN_SIZE 1024
// compression method values for backref_t and rle_t
typedef enum {
rle_8 = 0,
rle_16 = 1,
rle_seq = 2,
lz_norm = 0,
lz_rot = 1,
lz_rev = 2
} method_e;
// used to store and compare backref candidates
typedef struct {
uint16_t offset, size;
method_e method;
} backref_t;
// used to store RLE candidates
typedef struct {
uint16_t size, data;
method_e method;
} rle_t;
size_t pack (uint8_t *unpacked, uint32_t inputsize, uint8_t *packed, int fast);
size_t unpack (uint8_t *packed, uint8_t *unpacked);
size_t unpack_from_file (FILE *file, unsigned int offset, uint8_t *unpacked);
#ifdef __cplusplus
}
#endif
// end include guard
#endif

View file

@ -10,6 +10,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include "compress.h"
int main (int argc, char **argv) {

View file

@ -11,6 +11,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "compress.h"