mirror of
https://github.com/intel/isa-l.git
synced 2024-12-12 09:23:50 +01:00
d3cfb2fb77
The goal of this patch is to make isa-l testsuite pass on s390 with minimal changes to the library. The one and only reason isa-l does not work on s390 at the moment is that s390 is big-endian, and isa-l assumes little-endian at a lot of places. There are two flavors of this: loading/storing integers from/to memory, and overlapping structs. Loads/stores are already helpfully wrapped by unaligned.h header, so replace the functions there with endianness-aware variants. Solve struct member overlap by reversing their order on big-endian. Also, fix a couple of usages of uninitialized memory in the testsuite (found with MemorySanitizer). Fixes s390x part of #188. Change-Id: Iaf14a113bd266900192cc8b44212f8a47a8c7753 Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
#ifndef ENCODE_DF_H
|
|
#define ENCODE_DF_H
|
|
|
|
#include <stdint.h>
|
|
#include "igzip_lib.h"
|
|
#include "huff_codes.h"
|
|
|
|
/* Deflate Intermediate Compression Format */
|
|
#define LIT_LEN_BIT_COUNT 10
|
|
#define LIT_LEN_MASK ((1 << LIT_LEN_BIT_COUNT) - 1)
|
|
#define DIST_LIT_BIT_COUNT 9
|
|
#define DIST_LIT_MASK ((1 << DIST_LIT_BIT_COUNT) - 1)
|
|
#define ICF_DIST_OFFSET LIT_LEN_BIT_COUNT
|
|
#define NULL_DIST_SYM 30
|
|
|
|
#define LEN_START ISAL_DEF_LIT_SYMBOLS
|
|
#define LEN_OFFSET (LEN_START - ISAL_DEF_MIN_MATCH)
|
|
#define LEN_MAX (LEN_OFFSET + ISAL_DEF_MAX_MATCH)
|
|
#define LIT_START (NULL_DIST_SYM + 1)
|
|
#define ICF_CODE_LEN 32
|
|
|
|
struct deflate_icf {
|
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
uint32_t lit_len:LIT_LEN_BIT_COUNT;
|
|
uint32_t lit_dist:DIST_LIT_BIT_COUNT;
|
|
uint32_t dist_extra:ICF_CODE_LEN - DIST_LIT_BIT_COUNT - ICF_DIST_OFFSET;
|
|
#else
|
|
uint32_t dist_extra:ICF_CODE_LEN - DIST_LIT_BIT_COUNT - ICF_DIST_OFFSET;
|
|
uint32_t lit_dist:DIST_LIT_BIT_COUNT;
|
|
uint32_t lit_len:LIT_LEN_BIT_COUNT;
|
|
#endif
|
|
};
|
|
|
|
struct deflate_icf *encode_deflate_icf(struct deflate_icf *next_in, struct deflate_icf *end_in,
|
|
struct BitBuf2 *bb, struct hufftables_icf *hufftables);
|
|
#endif
|