Skip to content

Commit

Permalink
Merge pull request #79 from Cyan4973/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Cyan4973 committed Nov 29, 2015
2 parents dc1af5f + 305c325 commit e07e66c
Show file tree
Hide file tree
Showing 41 changed files with 9,036 additions and 2,070 deletions.
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@
# ################################################################

# Version number
export VERSION := 0.3.6
export VERSION := 0.4.0

PRGDIR = programs
ZSTDDIR = lib

.PHONY: clean
# Define nul output
ifneq (,$(filter Windows%,$(OS)))
VOID = nul
else
VOID = /dev/null
endif

.PHONY: default all zstdprogram clean install uninstall travis-install test clangtest gpptest armtest usan asan uasan

default: zstdprogram

Expand All @@ -49,8 +56,8 @@ zstdprogram:
$(MAKE) -C $(PRGDIR)

clean:
$(MAKE) -C $(ZSTDDIR) $@
$(MAKE) -C $(PRGDIR) $@
@$(MAKE) -C $(ZSTDDIR) $@ > $(VOID)
@$(MAKE) -C $(PRGDIR) $@ > $(VOID)
@echo Cleaning completed


Expand Down
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v0.4.0
Command line utility is now compatible with high compression levels
Removed zstdhc => merged into zstd
Added : ZBUFF API (see zstd_buffered.h)
Rolling buffer support

v0.3.6
small blocks params

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For a taste of its performance, here are a few benchmark numbers from a number o
|Name | Ratio | C.speed | D.speed |
|-----------------|-------|--------:|--------:|
| | | MB/s | MB/s |
| **zstd 0.3** |**2.858**|**280**| **670** |
| **zstd 0.4** |**2.872**|**280**| **670** |
| [zlib] 1.2.8 -1 | 2.730 | 70 | 300 |
| QuickLZ 1.5.1b6 | 2.237 | 370 | 415 |
| LZO 2.06 | 2.106 | 400 | 580 |
Expand Down
Binary file modified images/CSpeed.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/DSpeed.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# You can contact the author at :
# - ZSTD homepage : http://www.zstd.net
# - ZSTD source repository : https://github.com/Cyan4973/zstd
# - Public forum : https://groups.google.com/forum/#!forum/lz4c
# ################################################################

# Version numbers
Expand Down Expand Up @@ -63,14 +63,18 @@ else
SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER)
endif

default: libzstd

all: libzstd
.PHONY: default all clean install uninstall

libzstd: zstd.c huff0.c fse.c
default: clean libzstd

all: clean libzstd

libzstd: zstd_compress.c zstd_decompress.c huff0.c fse.c \
legacy/zstd_v01.c legacy/zstd_v02.c legacy/zstd_v03.c
@echo compiling static library
@$(CC) $(FLAGS) -c $^
@$(AR) rcs libzstd.a zstd.o huff0.o fse.o
@$(AR) rcs libzstd.a *.o
@echo compiling dynamic library $(LIBVER)
@$(CC) $(FLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
@echo creating versioned links
Expand Down
4 changes: 2 additions & 2 deletions lib/bitstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC)
MEM_writeLEST(bitC->ptr, bitC->bitContainer);
bitC->ptr += nbBytes;
bitC->bitPos &= 7;
bitC->bitContainer >>= nbBytes*8;
bitC->bitContainer >>= nbBytes*8; /* if bitPos >= sizeof(bitContainer)*8 --> undefined behavior */
}

MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC)
Expand All @@ -218,7 +218,7 @@ MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC)
bitC->ptr += nbBytes;
if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr;
bitC->bitPos &= 7;
bitC->bitContainer >>= nbBytes*8;
bitC->bitContainer >>= nbBytes*8; /* if bitPos >= sizeof(bitContainer)*8 --> undefined behavior */
}

/*! BIT_closeCStream
Expand Down
5 changes: 3 additions & 2 deletions lib/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ extern "C" {

#define ERROR_LIST(ITEM) \
ITEM(PREFIX(No_Error)) ITEM(PREFIX(GENERIC)) \
ITEM(PREFIX(memory_allocation)) \
ITEM(PREFIX(prefix_unknown)) ITEM(PREFIX(frameParameter_unsupported)) ITEM(PREFIX(frameParameter_unsupportedBy32bitsImplementation)) \
ITEM(PREFIX(init_missing)) ITEM(PREFIX(memory_allocation)) \
ITEM(PREFIX(dstSize_tooSmall)) ITEM(PREFIX(srcSize_wrong)) \
ITEM(PREFIX(prefix_unknown)) ITEM(PREFIX(corruption_detected)) \
ITEM(PREFIX(corruption_detected)) \
ITEM(PREFIX(tableLog_tooLarge)) ITEM(PREFIX(maxSymbolValue_tooLarge)) ITEM(PREFIX(maxSymbolValue_tooSmall)) \
ITEM(PREFIX(maxCode))

Expand Down
5 changes: 1 addition & 4 deletions lib/huff0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1495,10 +1495,7 @@ static inline size_t HUF_decodeStreamX6(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* c
while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p <= pEnd-4))
HUF_DECODE_SYMBOLX6_0(p, bitDPtr);

while (p <= pEnd-4)
HUF_DECODE_SYMBOLX6_0(p, bitDPtr); /* no need to reload : reached the end of DStream */

while (p < pEnd)
while ((BIT_reloadDStream(bitDPtr) <= BIT_DStream_endOfBuffer) && (p < pEnd))
p += HUF_decodeLastSymbolsX6(p, (U32)(pEnd-p), bitDPtr, dd, ds, dtLog);

return p-pStart;
Expand Down
8 changes: 6 additions & 2 deletions lib/legacy/zstd_legacy.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
zstd_v02 - decoder for 0.2 format
zstd_legacy - decoder for legacy format
Header File
Copyright (C) 2015, Yann Collet.
Expand Down Expand Up @@ -44,13 +44,15 @@ extern "C" {
#include "error.h" /* ERROR */
#include "zstd_v01.h"
#include "zstd_v02.h"
#include "zstd_v03.h"

MEM_STATIC unsigned ZSTD_isLegacy (U32 magicNumberLE)
{
switch(magicNumberLE)
{
case ZSTDv01_magicNumberLE :
case ZSTDv02_magicNumber : return 1;
case ZSTDv02_magicNumber :
case ZSTDv03_magicNumber : return 1;
default : return 0;
}
}
Expand All @@ -67,6 +69,8 @@ MEM_STATIC size_t ZSTD_decompressLegacy(
return ZSTDv01_decompress(dst, maxOriginalSize, src, compressedSize);
case ZSTDv02_magicNumber :
return ZSTDv02_decompress(dst, maxOriginalSize, src, compressedSize);
case ZSTDv03_magicNumber :
return ZSTDv03_decompress(dst, maxOriginalSize, src, compressedSize);
default :
return ERROR(prefix_unknown);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/legacy/zstd_v02.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits);
MEM_STATIC unsigned BIT_highbit32 (register U32 val)
{
# if defined(_MSC_VER) /* Visual */
unsigned long r;
unsigned long r=0;
_BitScanReverse ( &r, val );
return (unsigned) r;
# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */
Expand Down Expand Up @@ -3155,6 +3155,7 @@ static size_t ZSTD_decodeLiteralsBlock(void* ctx,
{
if (litSize > srcSize-3) return ERROR(corruption_detected);
memcpy(dctx->litBuffer, istart, litSize);
dctx->litPtr = dctx->litBuffer;
dctx->litBufSize = BLOCKSIZE;
dctx->litSize = litSize;
return litSize+3;
Expand Down
Loading

0 comments on commit e07e66c

Please sign in to comment.