src/3rdparty/webkit/WebCore/platform/text/StringHash.h
changeset 22 79de32ba3296
parent 0 1918ee327afb
child 30 5dc02b23752f
--- a/src/3rdparty/webkit/WebCore/platform/text/StringHash.h	Mon May 03 13:17:34 2010 +0300
+++ b/src/3rdparty/webkit/WebCore/platform/text/StringHash.h	Fri May 14 16:40:13 2010 +0300
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved
+ * Copyright (C) Research In Motion Limited 2009. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -47,6 +48,16 @@
             if (aLength != bLength)
                 return false;
 
+#if PLATFORM(ARM) || PLATFORM(SH4)
+            const UChar* aChars = a->characters();
+            const UChar* bChars = b->characters();
+            for (unsigned i = 0; i != aLength; ++i) {
+                if (*aChars++ != *bChars++)
+                    return false;
+            }
+            return true;
+#else
+            /* Do it 4-bytes-at-a-time on architectures where it's safe */
             const uint32_t* aChars = reinterpret_cast<const uint32_t*>(a->characters());
             const uint32_t* bChars = reinterpret_cast<const uint32_t*>(b->characters());
 
@@ -59,6 +70,7 @@
                 return false;
 
             return true;
+#endif
         }
 
         static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); }