Commit Graph

43 Commits

Author SHA1 Message Date
Takayuki MATSUOKA
80c3562c60 Reorder operation to avoid warning for unary minus operator for unsigned type
For example, VC++ shows the following warnings:

1>  xxhsum.c
1>..\..\xxhsum.c(620): warning C4146: unary minus operator applied to unsigned type, result still unsigned
1>..\..\xxhsum.c(621): warning C4146: unary minus operator applied to unsigned type, result still unsigned

The folliwing thread is good pointer for unary minus operators behaviour:

C: unary minus operator behavior with unsigned operands
http://stackoverflow.com/questions/8026694/

> 6.2.5c9 says: A computation involving unsigned operands can never overflow,
> because a result that cannot be represented by the resulting unsigned
> integer type is reduced modulo the number that is one greater than the
> largest value that can be represented by the resulting type.
2016-02-19 23:33:22 +09:00
Takayuki MATSUOKA
ecfcc51b38 Add usage messages for usage() and usage_advanced()
All messages are copied from md5sum.c in GNU coreutils.
2016-02-19 23:21:43 +09:00
Takayuki MATSUOKA
9a648f76a8 Fix stdin input for "xxhsum -c -" 2016-01-25 18:59:01 +09:00
Takayuki MATSUOKA
2783350952 Add redundant case for gcc -Wswitch-enum
- gcc -Wswitch-enum warns them.  But this is completely false-positive.

xxhsum.c:956:13: warning: enumeration value ‘GetLine_ok’ not handled in switch [-Wswitch-enum]
             switch (getLineResult)
             ^
2016-01-22 15:06:25 +09:00
Takayuki MATSUOKA
779a60563e Remove unused value 2016-01-22 15:02:46 +09:00
Takayuki MATSUOKA
c93b51c22e Implement variable length line reader.
- Basic logic is same as GNU coreutil's lib/getline.c and lib/getdelim.c
 - Since this implementation fully depends on fgetc(), there is possible performance problem.
2016-01-22 14:53:32 +09:00
Takayuki MATSUOKA
2cfc7a2d6a Fix wrong format specifier (%ul -> %lu) 2016-01-22 14:37:27 +09:00
Takayuki MATSUOKA
5c8aab6e6a Fix line number related definitions
- To keep code simple, now line number is "unsigned long" instead of "size_t".
 - We use "%ul" to print unsigned long.
2016-01-22 13:22:35 +09:00
Takayuki MATSUOKA
80897236f9 Fix return value
- Return value must be 0 for error.
2016-01-22 13:19:19 +09:00
Takayuki MATSUOKA
f47e8e1ff8 Add file check mode "-c" and related switches.
- Add the following command line switches
    - "-c"/"--check" : read XXH32/64 sums from FILEs and check them.
    - "--quiet" : Don't print OK.
    - "--status" : Don't output anything to stdout/stderr.
    - "--strict" : Treat any invalid line as error.
    - "--warn" : Show warning message for invalid line.
 - If all checksum procedure is succeeded, exit code is 0.
    - Otherwise exit code is 1.

All avobe functions basic logics are inherited from md5sum.
2016-01-20 23:45:52 +09:00
Takayuki MATSUOKA
1090f766c2 Split hash generation function for reusing
- Add hash generation function BMK_hashStream() which generates hash value from file stream.
 - First argument void* is not violate strict aliasing, but dedicated union may be good for readability.
2016-01-20 23:06:35 +09:00
Takayuki MATSUOKA
36c1981263 Add default hash seed symbols 2016-01-20 22:18:53 +09:00
Yann Collet
a881289521 new canonical API, suggested by @t-mat (#45) 2016-01-14 03:01:39 +01:00
Yann Collet
b5e9b75d84 added _canonicalDigest() functions, as suggested by Takatuki Matsuoka (#45) 2016-01-11 01:31:04 +01:00
Yann Collet
ac50dc0631 Limit notification size to remain within line budget 2016-01-11 00:30:08 +01:00
Yann Collet
5aabc409d1 Added : --little-endian command 2016-01-10 17:06:34 +01:00
Yann Collet
dcf7bbf17a Clarified display convention as big endian (#45) 2016-01-07 23:54:51 +01:00
Yann Collet
d34eb08294 fixed uninitialized warning (false positive) 2016-01-04 10:58:59 +01:00
Yann Collet
2b1cded67c added PRIVATE_API mode 2016-01-04 08:32:38 +01:00
Yann Collet
44f5038687 introduced semantic versioning 2016-01-03 23:56:13 +01:00
Yann Collet
ebde2748a7 stricter compliance with strict aliasing gcc warnings 2016-01-02 20:18:07 +01:00
Yann Collet
9ffb7e28c6 Compatibility with GCC/ARMv7 2015-08-19 15:11:24 +01:00
Yann Collet
68c1661a02 new test XXH64 unaligned
refactor internal benchmark
2015-08-17 15:17:12 +01:00
Yann Collet
87ef054e66 CPU unaligned load : Better detection for ARM cpus 2015-08-12 18:24:35 +01:00
Yann Collet
26772f1d5c Added : ability to select block size in benchmark mode 2015-08-12 17:10:16 +01:00
Yann Collet
24f017808a Added : wildcard support : can checksum multiple files 2015-08-08 00:22:56 +01:00
Yann Collet
cab86639a5 Added : XXH_NAMESPACE, for namespace emulation in C 2015-06-28 03:20:23 -08:00
Yann Collet
962fd0ab4d restored big-endian display 2015-05-07 15:27:27 +01:00
Yann Collet
76c90f1d0f Added : internal benchmark mode 2015-05-07 13:30:27 +01:00
Yann Collet
3b63fc28ca Added -Wcast-qual compilation flag, as suggested by Isaac Turner 2015-05-05 11:25:28 +01:00
Yann Collet
049aa14e15 added more tests 2015-05-05 01:01:10 +01:00
Yann Collet
57fda00476 sync with lz4 version 2015-05-04 22:56:53 +01:00
Yann Collet
a3f950c24c updated some comments 2015-01-01 17:10:04 +01:00
Yann Collet
edb6d79f51 xxhash.c is C90 compatible 2014-12-17 12:15:03 +01:00
Yann Collet
bdbf0a541a minor comment update 2014-12-09 19:16:15 +01:00
Yann Collet
86fe903d97 xxhsum display result using big-endian convention 2014-12-09 18:42:33 +01:00
Yann Collet
f7f77986f1 xxhsum : can use stdin as input (default) 2014-10-29 13:55:58 +01:00
Yann Collet
ef3cc0c80a xxhsum : introduces gettimeofday() as a potential replacement for ftime() 2014-10-29 02:42:26 +01:00
Yann Collet
552a135701 xxhsum : redirect result to output, and other messages to stderr 2014-10-23 21:36:23 +01:00
Yann Collet
9ae604f15f Fix issue 23 : xxhsum output to stdout 2014-10-18 12:15:13 +01:00
Yann Collet
0093c7ac0e Fix issue 22 : use XXH_malloc() & XXH_free() 2014-10-18 12:10:27 +01:00
Yann Collet
f3f6e3301c tune xxhsum display messages 2014-10-18 12:03:38 +01:00
Yann Collet
9e10157ef3 renamed bench.c into xxhsum.c 2014-10-18 11:46:37 +01:00