summaryrefslogtreecommitdiff
path: root/cpp/src/qmf/engine
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2011-05-09 19:56:20 +0000
committerAndrew Stitcher <astitcher@apache.org>2011-05-09 19:56:20 +0000
commitf5e1d9d0e129a804e9eb8da9e83bf7846b662e78 (patch)
tree1fa184c77269803e208f02cc52618b138310e28f /cpp/src/qmf/engine
parent0a103a150a50c5e233f29b69db79cac884925e58 (diff)
downloadqpid-python-f5e1d9d0e129a804e9eb8da9e83bf7846b662e78.tar.gz
QPID-3004: Get Clang to compile qpid c++
- Avoid pointer alignment conversion error by using union instead git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1101184 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qmf/engine')
-rw-r--r--cpp/src/qmf/engine/SchemaImpl.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/cpp/src/qmf/engine/SchemaImpl.cpp b/cpp/src/qmf/engine/SchemaImpl.cpp
index e0948a9911..f75663e131 100644
--- a/cpp/src/qmf/engine/SchemaImpl.cpp
+++ b/cpp/src/qmf/engine/SchemaImpl.cpp
@@ -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;