diff options
| author | Charles E. Rolke <chug@apache.org> | 2011-10-14 18:29:57 +0000 |
|---|---|---|
| committer | Charles E. Rolke <chug@apache.org> | 2011-10-14 18:29:57 +0000 |
| commit | 706c8476ab9e4074067eedda2ffeba36ed35089d (patch) | |
| tree | ebab7003d136c3887521e4d4b126b68e5155faab /qpid/cpp/src/qmf/engine/SchemaImpl.h | |
| parent | ebbdf159fec086d8888a76c360ad3d29cb93bb28 (diff) | |
| download | qpid-python-706c8476ab9e4074067eedda2ffeba36ed35089d.tar.gz | |
QPID-3540 Typecasting and alignment requirements for various platforms
On sparc platform:
SchemaHash::update() fails when the hash byte array is cast as two quadwords
in a union. This fix uses the union in the definition of the hash byte array
to coerce the compiler to place them in quadword alignment when they are
created.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1183456 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qmf/engine/SchemaImpl.h')
| -rw-r--r-- | qpid/cpp/src/qmf/engine/SchemaImpl.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/qpid/cpp/src/qmf/engine/SchemaImpl.h b/qpid/cpp/src/qmf/engine/SchemaImpl.h index 8b079a5ec6..683fb6f8f0 100644 --- a/qpid/cpp/src/qmf/engine/SchemaImpl.h +++ b/qpid/cpp/src/qmf/engine/SchemaImpl.h @@ -35,7 +35,10 @@ namespace engine { // they've been registered. class SchemaHash { - uint8_t hash[16]; + union h { + uint8_t b[16]; + uint64_t q[2]; + } hash; public: SchemaHash(); void encode(qpid::framing::Buffer& buffer) const; @@ -47,7 +50,7 @@ namespace engine { void update(Direction d) { update((uint8_t) d); } void update(Access a) { update((uint8_t) a); } void update(bool b) { update((uint8_t) (b ? 1 : 0)); } - const uint8_t* get() const { return hash; } + const uint8_t* get() const { return hash.b; } bool operator==(const SchemaHash& other) const; bool operator<(const SchemaHash& other) const; bool operator>(const SchemaHash& other) const; |
