Index: tests/GrBinHashKeyTest.cpp |
diff --git a/tests/GrBinHashKeyTest.cpp b/tests/GrBinHashKeyTest.cpp |
index 605fd9f29a429d2e5f94a37c4fce03af2a57a369..175719d3cd238d119d6306e356aedb2ea9361bd7 100644 |
--- a/tests/GrBinHashKeyTest.cpp |
+++ b/tests/GrBinHashKeyTest.cpp |
@@ -13,11 +13,17 @@ |
#include "Test.h" |
+struct AlignedKey { |
+ uint32_t align; |
+ char key[8]; |
+}; |
+ |
template<typename KeyType> static void TestHash(skiatest::Reporter* reporter) { |
- const char* testStringA_ = "abcdABCD"; |
- const char* testStringB_ = "abcdBBCD"; |
- const uint32_t* testStringA = reinterpret_cast<const uint32_t*>(testStringA_); |
- const uint32_t* testStringB = reinterpret_cast<const uint32_t*>(testStringB_); |
+ AlignedKey a, b; |
+ memcpy(&a.key, "abcdABCD", 8); |
+ memcpy(&b.key, "abcdBBCD", 8); |
+ const uint32_t* testStringA = reinterpret_cast<const uint32_t*>(&a.key); |
+ const uint32_t* testStringB = reinterpret_cast<const uint32_t*>(&b.key); |
KeyType keyA; |
keyA.setKeyData(testStringA); |