diff options
author | Yann Collet <yann.collet.73@gmail.com> | 2015-03-13 01:24:08 (GMT) |
---|---|---|
committer | Yann Collet <yann.collet.73@gmail.com> | 2015-03-13 01:24:08 (GMT) |
commit | 45a357fd1704e9c6d2d8037277bda62e8c86308e (patch) | |
tree | 55cff5ceae829ff651af18bf4129b9db119a7379 /programs/datagen.c | |
parent | e38c268b5a4b9289c29ad4d11c8f81c13b52464c (diff) | |
download | lz4-45a357fd1704e9c6d2d8037277bda62e8c86308e.zip lz4-45a357fd1704e9c6d2d8037277bda62e8c86308e.tar.gz lz4-45a357fd1704e9c6d2d8037277bda62e8c86308e.tar.bz2 |
Improved sparse file support
Diffstat (limited to 'programs/datagen.c')
-rwxr-xr-x[-rw-r--r--] | programs/datagen.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/programs/datagen.c b/programs/datagen.c index 743691e..bccb21e 100644..100755 --- a/programs/datagen.c +++ b/programs/datagen.c @@ -137,7 +137,7 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match while (matchProba >= 1.0) { size_t size0 = RDG_rand(seed) & 3; - size0 = 1U << (16 + size0 * 2); + size0 = (size_t)1 << (16 + size0 * 2); size0 += RDG_rand(seed) & (size0-1); /* because size0 is power of 2*/ if (buffSize < pos + size0) { @@ -159,11 +159,11 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match if (RDG_RAND15BITS < matchProba32) { /* Copy (within 32K) */ - int match; - U32 d; + size_t match; + size_t d; int length = RDG_RANDLENGTH + 4; U32 offset = RDG_RAND15BITS + 1; - if (offset > pos) offset = pos; + if (offset > pos) offset = (U32)pos; match = pos - offset; d = pos + length; if (d > buffSize) d = buffSize; |