From 143517847c3e2accf9489946fae9460d9e9f45a7 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Sun, 9 Mar 2014 22:34:52 -0700 Subject: [PATCH 179/225] Ticket #47734 - Change made in resolving ticket #346 fails on Debian SPARC64 Description: The following change is not generic beyond x86 and x86_64 architecture. Putting the change into "#if (defined(CPU_x86) || defined(CPU_x86_64))". commit c0151f78509c35250095da6e2785842337963008 Trac Ticket #346 - Slow ldapmodify operation time for large quantities of multi-valued attribute values 3) In slapi_has8thBit, instead of checking the 8th bit one byte by one byte, check 4 bytes at one time. https://fedorahosted.org/389/ticket/47734 Reviewed by rmeggins@redhat.com (Thank you, Rich!!) (cherry picked from commit 1e00913312e165ead2f3a25b6d70f7839115007e) (cherry picked from commit ba9248d02447dc693114961d9296ecb742a75add) (cherry picked from commit 450607a75d23984da12c83e785a2e1cfbf49964d) (cherry picked from commit 9760c042717fdaba5af65999629ff87fde46520d) --- ldap/servers/slapd/utf8compare.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ldap/servers/slapd/utf8compare.c b/ldap/servers/slapd/utf8compare.c index e336ccb..d2dd83e 100644 --- a/ldap/servers/slapd/utf8compare.c +++ b/ldap/servers/slapd/utf8compare.c @@ -60,6 +60,7 @@ typedef struct sUpperLowerTbl { int slapi_has8thBit(unsigned char *s) { +#if (defined(CPU_x86) || defined(CPU_x86_64)) #define MY8THBITWIDTH 4 /* sizeof(PRUint32) */ #define MY8THBITFILTER 0x80808080 unsigned char *p, *stail, *ltail; @@ -73,14 +74,20 @@ slapi_has8thBit(unsigned char *s) return 1; } } - for (; p < ltail; p++) { +#undef MY8THBITWIDTH +#undef MY8THBITFILTER + for (; p < ltail; p++) +#else + unsigned char *p, *tail; + tail = s + strlen((char *)s); + for (p = s; p < tail; p++) +#endif + { if (0x80 & *p) { return 1; } } return 0; -#undef MY8THBITWIDTH -#undef MY8THBITFILTER } /* -- 1.8.1.4