diff options
author | yann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd> | 2012-08-03 14:33:12 (GMT) |
---|---|---|
committer | yann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd> | 2012-08-03 14:33:12 (GMT) |
commit | 19a078b132f515405ab0b297c3cb2673dd2870de (patch) | |
tree | d362601cf7a59f0377baae0765b10f64773c177d /lz4.c | |
parent | 89921dd39eaa4910eda636f68d3cb5f960b616ac (diff) | |
download | lz4-19a078b132f515405ab0b297c3cb2673dd2870de.zip lz4-19a078b132f515405ab0b297c3cb2673dd2870de.tar.gz lz4-19a078b132f515405ab0b297c3cb2673dd2870de.tar.bz2 |
Improved speed under Visual
git-svn-id: https://lz4.googlecode.com/svn/trunk@73 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
Diffstat (limited to 'lz4.c')
-rw-r--r-- | lz4.c | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -402,8 +402,27 @@ inline int LZ4_compressCtx(void** ctx, length = ip - anchor;
token = op++;
if unlikely(op + length + (2 + 1 + LASTLITERALS) + (length>>8) >= oend) return 0; // Check output limit
+#ifdef _MSC_VER
+ if (length>=(int)RUN_MASK)
+ {
+ int len = length-RUN_MASK;
+ *token=(RUN_MASK<<ML_BITS);
+ if (len>254)
+ {
+ do { *op++ = 255; len -= 255; } while (len>254);
+ *op++ = (BYTE)len;
+ memcpy(op, anchor, length);
+ op += length;
+ goto _next_match;
+ }
+ else
+ *op++ = (BYTE)len;
+ }
+ else *token = (length<<ML_BITS);
+#else
if (length>=(int)RUN_MASK) { *token=(RUN_MASK<<ML_BITS); len = length-RUN_MASK; for(; len > 254 ; len-=255) *op++ = 255; *op++ = (BYTE)len; }
else *token = (length<<ML_BITS);
+#endif
// Copy Literals
LZ4_BLINDCOPY(anchor, op, length);
@@ -547,8 +566,27 @@ inline int LZ4_compress64kCtx(void** ctx, length = ip - anchor;
token = op++;
if unlikely(op + length + (2 + 1 + LASTLITERALS) + (length>>8) >= oend) return 0; // Check output limit
+#ifdef _MSC_VER
+ if (length>=(int)RUN_MASK)
+ {
+ int len = length-RUN_MASK;
+ *token=(RUN_MASK<<ML_BITS);
+ if (len>254)
+ {
+ do { *op++ = 255; len -= 255; } while (len>254);
+ *op++ = (BYTE)len;
+ memcpy(op, anchor, length);
+ op += length;
+ goto _next_match;
+ }
+ else
+ *op++ = (BYTE)len;
+ }
+ else *token = (length<<ML_BITS);
+#else
if (length>=(int)RUN_MASK) { *token=(RUN_MASK<<ML_BITS); len = length-RUN_MASK; for(; len > 254 ; len-=255) *op++ = 255; *op++ = (BYTE)len; }
else *token = (length<<ML_BITS);
+#endif
// Copy Literals
LZ4_BLINDCOPY(anchor, op, length);
|