]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
deteect 64 bit
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 12 Dec 2012 20:09:39 +0000 (14:09 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 12 Dec 2012 20:09:39 +0000 (14:09 -0600)
src/include/switch_platform.h
src/include/switch_utils.h

index 1140aac8ba3a73629c45337d0f80ffde672e7cb9..030a7e2244ee7673e50b2167ae5ef31633024490 100644 (file)
@@ -265,6 +265,11 @@ typedef intptr_t switch_ssize_t;
 #endif
 #endif
 
+
+#if UINTPTR_MAX == 0xffffffffffffffff
+#define FS_64BIT 1
+#endif
+
 #endif
 
 #define SWITCH_TIME_T_FMT SWITCH_INT64_T_FMT
index a3ffc4e54663cbc46749a0311f03164dccbcb16a..4705069728737418e522b4f1fbdbc5aaee7ecbfa 100644 (file)
@@ -51,35 +51,66 @@ static inline uint32_t switch_toupper(uint32_t eax)
        return eax - ebx;
 }
 
+#ifdef FS_64BIT
+
+static inline void switch_toupper_max(char *s)
+{
+       uint64_t *b,*p;
+       char *c;
+       size_t l;
+
+       l = strlen(s);
+
+       p = (uint64_t *) s;
+
+       while (l > 8) {
+               b = p;
+               *b = (uint32_t) switch_toupper(*b);
+               b++;
+               p++;
+               l -= 8;
+       }
+
+       c = (char *)p;
+
+       while(l > 0) {
+               *c = (char) switch_toupper(*c);
+               c++;
+               l--;
+       }
+
+}
+
+#else 
 
 static inline void switch_toupper_max(char *s)
 {
        uint32_t *b,*p;
        char *c;
        size_t l;
-       int div = 0, rem = 0;
-       int i;
 
        l = strlen(s);
-       div = (int) (l / 4);
-       rem = l % 4;
 
        p = (uint32_t *) s;
 
-       for (i = 0; i < div; i++) {
+       while (l > 4) {
                b = p;
                *b = (uint32_t) switch_toupper(*b);
                b++;
                p++;
+               l -= 4;
        }
 
        c = (char *)p;
 
-       for (i = 0; i < rem; i++) {
+       while(l > 0) {
                *c = (char) switch_toupper(*c);
                c++;
+               l--;
        }
+       
 }
+#endif
 
 
 SWITCH_DECLARE(int) old_switch_toupper(int c);