Updating TODO
[awesomized/libmemcached] / libmemcached / jenkins_hash.c
index 940e4718c0810ae976a85e822383269ddbc4e6be..262ff937bbcf300e59fbf346a9c1329f7c32df0c 100644 (file)
@@ -63,7 +63,9 @@ uint32_t jenkins_hash(const void *key, size_t length, uint32_t initval)
   a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
 
   u.ptr = key;
-  if ((u.i & 0x3) == 0) {
+#ifdef BYTEORDER_LITTLE_ENDIAN
+  if ((u.i & 0x3) == 0)
+  {
     const uint32_t *k = (const uint32_t *)key;         /* read 32-bit chunks */
 
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
@@ -104,7 +106,9 @@ uint32_t jenkins_hash(const void *key, size_t length, uint32_t initval)
     case 0 : return c;              /* zero length strings require no mixing */
     }
 
-  } else if ((u.i & 0x1) == 0) {
+  } 
+  else if ((u.i & 0x1) == 0)
+  {
     const uint16_t *k = (const uint16_t *)key;         /* read 16-bit chunks */
     const uint8_t  *k8;
 
@@ -151,7 +155,10 @@ uint32_t jenkins_hash(const void *key, size_t length, uint32_t initval)
     case 0 : return c;                     /* zero length requires no mixing */
     }
 
-  } else {                        /* need to read the key one byte at a time */
+  } 
+  else
+  {                        /* need to read the key one byte at a time */
+#endif /* little endian */
     const uint8_t *k = (const uint8_t *)key;
 
     /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
@@ -192,7 +199,9 @@ uint32_t jenkins_hash(const void *key, size_t length, uint32_t initval)
              break;
     case 0 : return c;
     }
+#ifdef BYTEORDER_LITTLE_ENDIAN
   }
+#endif
 
   final(a,b,c);
   return c;