2016-09-27 11:41:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/utils/SkRandom.h"
|
|
|
|
#include "tests/Test.h"
|
2016-09-27 11:41:45 +00:00
|
|
|
|
|
|
|
// Clang seems to think only 32-bit alignment is guaranteed on 32-bit x86 Android.
|
|
|
|
// See https://reviews.llvm.org/D8357
|
|
|
|
// This is why we have disabled -Wover-aligned there (we allocate 8-byte aligned structs in Ganesh).
|
|
|
|
DEF_TEST(OverAligned, r) {
|
|
|
|
SkRandom rand;
|
|
|
|
// Let's test that assertion. We think it really should be providing 8-byte alignment.
|
|
|
|
for (int i = 0; i < 1000; i++) {
|
2016-09-27 15:26:50 +00:00
|
|
|
void* p = sk_malloc_throw(rand.nextRangeU(0,100));
|
2016-09-27 11:41:45 +00:00
|
|
|
REPORTER_ASSERT(r, SkIsAlign8((uintptr_t)p));
|
2016-09-27 15:26:50 +00:00
|
|
|
sk_free(p);
|
2016-09-27 11:41:45 +00:00
|
|
|
}
|
|
|
|
}
|