qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1101184 - /qpid/trunk/qpid/cpp/src/qmf/engine/SchemaImpl.cpp
Date Mon, 09 May 2011 19:56:21 GMT
Author: astitcher
Date: Mon May  9 19:56:20 2011
New Revision: 1101184

URL: http://svn.apache.org/viewvc?rev=1101184&view=rev
Log:
QPID-3004: Get Clang to compile qpid c++
- Avoid pointer alignment conversion error by using union
  instead

Modified:
    qpid/trunk/qpid/cpp/src/qmf/engine/SchemaImpl.cpp

Modified: qpid/trunk/qpid/cpp/src/qmf/engine/SchemaImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/engine/SchemaImpl.cpp?rev=1101184&r1=1101183&r2=1101184&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/engine/SchemaImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/engine/SchemaImpl.cpp Mon May  9 19:56:20 2011
@@ -55,9 +55,12 @@ void SchemaHash::update(uint8_t data)
 
 void SchemaHash::update(const char* data, uint32_t len)
 {
-    uint64_t* first  = (uint64_t*) hash;
-    uint64_t* second = (uint64_t*) hash + 1;
-
+    union h {
+        uint8_t  b[16];
+        uint64_t q[2];
+    }* h = reinterpret_cast<union h*>(&hash[0]);
+    uint64_t* first  = &h->q[0];
+    uint64_t* second = &h->q[1];
     for (uint32_t idx = 0; idx < len; idx++) {
         *first = *first ^ (uint64_t) data[idx];
         *second = *second << 1;



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message