diff options
author | antirez <antirez@gmail.com> | 2013-05-08 09:59:51 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2013-05-08 10:01:27 +0200 |
commit | 0ae1b5b0a197154167a895f1188f1822a78732e4 (patch) | |
tree | f8e2aa200ad0073648b6330522e10dd37ef9f354 | |
parent | c1ae7d2377d716bec7d064fff71ea37a66293f48 (diff) | |
download | redis-0ae1b5b0a197154167a895f1188f1822a78732e4.tar.gz |
Revert "use long long instead of size_t make it more safe"
This reverts commit 2c75f2cf1aa0d9cc8256517bd6f3d8a82088ee1a.
After further analysis, it is very unlikely that we'll raise the
string size limit to > 512MB, and at the same time such big strings
will be used in 32 bit systems.
Better to revert to size_t so that 32 bit processors will not be
forced to use a 64 bit counter in normal operations, that is currently
completely useless.
-rw-r--r-- | src/bitops.c | 4 | ||||
-rw-r--r-- | src/redis.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/bitops.c b/src/bitops.c index 70146af37..47f768c31 100644 --- a/src/bitops.c +++ b/src/bitops.c @@ -58,8 +58,8 @@ static int getBitOffsetFromArgument(redisClient *c, robj *o, size_t *offset) { /* Count number of bits set in the binary array pointed by 's' and long * 'count' bytes. The implementation of this function is required to * work with a input string length up to 512 MB. */ -long long popcount(void *s, long count) { - long long bits = 0; +size_t popcount(void *s, long count) { + size_t bits = 0; unsigned char *p; uint32_t *p4 = s; static const unsigned char bitsinbyte[256] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8}; diff --git a/src/redis.h b/src/redis.h index d5ddfb8c5..11fc7d662 100644 --- a/src/redis.h +++ b/src/redis.h @@ -984,7 +984,7 @@ long long mstime(void); void getRandomHexChars(char *p, unsigned int len); uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l); void exitFromChild(int retcode); -long long popcount(void *s, long count); +size_t popcount(void *s, long count); void redisSetProcTitle(char *title); /* networking.c -- Networking and Client related operations */ |