mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Merge branch 'sparc' of ssh://209.141.57.197:12222//export/home/antirez/redis into sparc
This commit is contained in:
commit
ed7e331051
13
src/bitops.c
13
src/bitops.c
@ -104,6 +104,7 @@ long redisBitpos(void *s, unsigned long count, int bit) {
|
|||||||
unsigned long skipval, word = 0, one;
|
unsigned long skipval, word = 0, one;
|
||||||
long pos = 0; /* Position of bit, to return to the caller. */
|
long pos = 0; /* Position of bit, to return to the caller. */
|
||||||
unsigned long j;
|
unsigned long j;
|
||||||
|
int found;
|
||||||
|
|
||||||
/* Process whole words first, seeking for first word that is not
|
/* Process whole words first, seeking for first word that is not
|
||||||
* all ones or all zeros respectively if we are lookig for zeros
|
* all ones or all zeros respectively if we are lookig for zeros
|
||||||
@ -117,22 +118,28 @@ long redisBitpos(void *s, unsigned long count, int bit) {
|
|||||||
/* Skip initial bits not aligned to sizeof(unsigned long) byte by byte. */
|
/* Skip initial bits not aligned to sizeof(unsigned long) byte by byte. */
|
||||||
skipval = bit ? 0 : UCHAR_MAX;
|
skipval = bit ? 0 : UCHAR_MAX;
|
||||||
c = (unsigned char*) s;
|
c = (unsigned char*) s;
|
||||||
|
found = 0;
|
||||||
while((unsigned long)c & (sizeof(*l)-1) && count) {
|
while((unsigned long)c & (sizeof(*l)-1) && count) {
|
||||||
if (*c != skipval) break;
|
if (*c != skipval) {
|
||||||
|
found = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
c++;
|
c++;
|
||||||
count--;
|
count--;
|
||||||
pos += 8;
|
pos += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip bits with full word step. */
|
/* Skip bits with full word step. */
|
||||||
skipval = bit ? 0 : ULONG_MAX;
|
|
||||||
l = (unsigned long*) c;
|
l = (unsigned long*) c;
|
||||||
|
if (!found) {
|
||||||
|
skipval = bit ? 0 : ULONG_MAX;
|
||||||
while (count >= sizeof(*l)) {
|
while (count >= sizeof(*l)) {
|
||||||
if (*l != skipval) break;
|
if (*l != skipval) break;
|
||||||
l++;
|
l++;
|
||||||
count -= sizeof(*l);
|
count -= sizeof(*l);
|
||||||
pos += sizeof(*l)*8;
|
pos += sizeof(*l)*8;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Load bytes into "word" considering the first byte as the most significant
|
/* Load bytes into "word" considering the first byte as the most significant
|
||||||
* (we basically consider it as written in big endian, since we consider the
|
* (we basically consider it as written in big endian, since we consider the
|
||||||
@ -658,7 +665,7 @@ void bitopCommand(client *c) {
|
|||||||
* result in GCC compiling the code using multiple-words load/store
|
* result in GCC compiling the code using multiple-words load/store
|
||||||
* operations that are not supported even in ARM >= v6. */
|
* operations that are not supported even in ARM >= v6. */
|
||||||
j = 0;
|
j = 0;
|
||||||
#ifndef __arm__
|
#ifndef USE_ALIGNED_ACCESS
|
||||||
if (minlen >= sizeof(unsigned long)*4 && numkeys <= 16) {
|
if (minlen >= sizeof(unsigned long)*4 && numkeys <= 16) {
|
||||||
unsigned long *lp[16];
|
unsigned long *lp[16];
|
||||||
unsigned long *lres = (unsigned long*) res;
|
unsigned long *lres = (unsigned long*) res;
|
||||||
|
@ -215,4 +215,13 @@ void setproctitle(const char *fmt, ...);
|
|||||||
#define __arm64__
|
#define __arm64__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Make sure we can test for SPARC just checking for __sparc__. */
|
||||||
|
#if defined(__sparc) && !defined(__sparc__)
|
||||||
|
#define __sparc__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__sparc__) || defined(__arm__)
|
||||||
|
#define USE_ALIGNED_ACCESS
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -401,7 +401,7 @@ uint64_t MurmurHash64A (const void * key, int len, unsigned int seed) {
|
|||||||
uint64_t k;
|
uint64_t k;
|
||||||
|
|
||||||
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||||
#if defined(__arm__) && !defined(__arm64__)
|
#ifdef USE_ALIGNED_ACCESS
|
||||||
memcpy(&k,data,sizeof(uint64_t));
|
memcpy(&k,data,sizeof(uint64_t));
|
||||||
#else
|
#else
|
||||||
k = *((uint64_t*)data);
|
k = *((uint64_t*)data);
|
||||||
|
Loading…
Reference in New Issue
Block a user