Sha256: aff75dd08dba6e284fb2eec159182a35a8fc10ea8c0d853f1a791e038cfece8a

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

#ifndef EXTLZHAM_H
#define EXTLZHAM_H 1

#include <stdint.h>
#include <ruby.h>
#include <ruby/thread.h>
#include <lzham.h>

#define RDOCFAKE(STMT)

extern VALUE mLZHAM;
extern VALUE eError;
extern VALUE cEncoder;
extern VALUE cDecoder;
extern VALUE mConsts;

extern ID id_op_lshift;
extern ID id_dictsize;
extern ID id_level;
extern ID id_table_update_rate;
extern ID id_threads;
extern ID id_flags;
extern ID id_table_max_update_interval;
extern ID id_table_update_interval_slow_rate;

enum {
    //WORKBUF_SIZE = 256 * 1024, /* 256 KiB */
    WORKBUF_SIZE = 1 << 20, /* 1 MiB */
    //WORKBUF_SIZE = 1 << 16, /* 64 KiB */
};

const char *extlzham_encode_status_str(lzham_compress_status_t status);
const char *extlzham_decode_status_str(lzham_decompress_status_t status);
void extlzham_encode_error(lzham_compress_status_t status);
void extlzham_decode_error(lzham_decompress_status_t status);

void extlzham_init_error(void);
void extlzham_init_constants(void);
void extlzham_init_encoder(void);
void extlzham_init_decoder(void);

static inline uint32_t
aux_getoptu32(VALUE hash, ID key, uint32_t defaultvalue)
{
    VALUE d = rb_hash_lookup2(hash, ID2SYM(key), Qundef);
    if (d == Qundef) { return defaultvalue; }
    return NUM2UINT(d);
}

static inline VALUE
aux_str_reserve(VALUE str, size_t size)
{
    if (size > rb_str_capacity(str)) {
        rb_str_modify_expand(str, size - RSTRING_LEN(str));
    } else {
        rb_str_modify(str);
    }

    return str;
}

#endif /* !EXTLZHAM_H */

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
extlzham-0.0.1.PROTOTYPE3-x86-mingw32 ext/extlzham.h
extlzham-0.0.1.PROTOTYPE3 ext/extlzham.h