diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-09 17:44:44 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-09 17:44:44 +0000 |
commit | 142e1fe7cf5dc82e5d4c107b06756302f0cbf96d (patch) | |
tree | 456e9e8eff8e3b3aef8e703c50587b3688c90917 /src/core/SkPictureFlat.h | |
parent | fc8581b2d8c63439162c701623bce096088ce6e6 (diff) |
restore 4478 w/ fixed assert (no long need 8-byte alignment)
git-svn-id: http://skia.googlecode.com/svn/trunk@4480 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPictureFlat.h')
-rw-r--r-- | src/core/SkPictureFlat.h | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h index 5918261204..7888b2e563 100644 --- a/src/core/SkPictureFlat.h +++ b/src/core/SkPictureFlat.h @@ -156,16 +156,11 @@ public: static int Compare(const SkFlatData* a, const SkFlatData* b) { size_t bytesToCompare = sizeof(a->fChecksum) + a->fAllocSize; -#if SK_PREFER_32BIT_CHECKSUM - typedef uint32_t CompareType; SkASSERT(SkIsAlign4(bytesToCompare)); -#else - typedef uint64_t CompareType; - SkASSERT(SkIsAlign8(bytesToCompare)); -#endif - const CompareType* a_ptr = &(a->fChecksum); - const CompareType* b_ptr = &(b->fChecksum); - const CompareType* stop = a_ptr + bytesToCompare / sizeof(CompareType); + + const uint32_t* a_ptr = &(a->fChecksum); + const uint32_t* b_ptr = &(b->fChecksum); + const uint32_t* stop = a_ptr + bytesToCompare / sizeof(uint32_t); while(a_ptr < stop) { if (*a_ptr != *b_ptr) { return (*a_ptr < *b_ptr) ? -1 : 1; @@ -178,6 +173,8 @@ public: int index() const { return fIndex; } void* data() const { return (char*)this + sizeof(*this); } + // We guarantee that our data is 32bit aligned + uint32_t* data32() const { return (uint32_t*)this->data(); } #ifdef SK_DEBUG_SIZE size_t size() const { return sizeof(SkFlatData) + fAllocSize; } @@ -199,11 +196,7 @@ private: int fIndex; int32_t fAllocSize; // fChecksum must be defined last in order to be contiguous with data() -#if SK_PREFER_32BIT_CHECKSUM uint32_t fChecksum; -#else - uint64_t fChecksum; -#endif }; template <class T> |