Flutter Engine
The Flutter Engine
third_party
skia
tests
OverAlignedTest.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2016 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
include/core/SkTypes.h
"
9
#include "
include/private/base/SkAlign.h
"
10
#include "
include/private/base/SkMalloc.h
"
11
#include "
src/base/SkRandom.h
"
12
#include "
tests/Test.h
"
13
#include <stdint.h>
14
15
// Clang seems to think only 32-bit alignment is guaranteed on 32-bit x86 Android.
16
// See https://reviews.llvm.org/D8357
17
// This is why we have disabled -Wover-aligned there (we allocate 8-byte aligned structs in Ganesh).
18
DEF_TEST
(OverAligned, r) {
19
SkRandom
rand;
20
// Let's test that assertion. We think it really should be providing 8-byte alignment.
21
for
(
int
i
= 0;
i
< 1000;
i
++) {
22
void
*
p
=
sk_malloc_throw
(rand.
nextRangeU
(0,100));
23
REPORTER_ASSERT
(r,
SkIsAlign8
((uintptr_t)
p
));
24
sk_free
(
p
);
25
}
26
}
DEF_TEST
DEF_TEST(OverAligned, r)
Definition:
OverAlignedTest.cpp:18
SkAlign.h
SkIsAlign8
static constexpr bool SkIsAlign8(T x)
Definition:
SkAlign.h:21
SkMalloc.h
sk_free
SK_API void sk_free(void *)
Definition:
SkMemory_malloc.cpp:83
sk_malloc_throw
static void * sk_malloc_throw(size_t size)
Definition:
SkMalloc.h:67
SkRandom.h
SkTypes.h
Test.h
REPORTER_ASSERT
#define REPORTER_ASSERT(r, cond,...)
Definition:
Test.h:286
SkRandom
Definition:
SkRandom.h:27
SkRandom::nextRangeU
uint32_t nextRangeU(uint32_t min, uint32_t max)
Definition:
SkRandom.h:80
i
int i
Definition:
fl_socket_accessible.cc:18
dart_profiler_symbols.p
p
Definition:
dart_profiler_symbols.py:55
Generated on Sun Jun 23 2024 21:56:40 for Flutter Engine by
1.9.4