Flutter Engine
The Flutter Engine
SkMemset_opts.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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#ifndef SkUtils_opts_DEFINED
9#define SkUtils_opts_DEFINED
10
11#include <stdint.h>
12#include "src/base/SkVx.h"
13
14namespace SK_OPTS_NS {
15
16 template <typename T>
17 static void memsetT(T buffer[], T value, int count) {
18 #if defined(SK_CPU_SSE_LEVEL) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX
19 static constexpr int VecSize = 32 / sizeof(T);
20 #else
21 static constexpr int VecSize = 16 / sizeof(T);
22 #endif
23 static_assert(VecSize > 0, "T is too big for memsetT");
24 // Create an vectorized version of value
25 skvx::Vec<VecSize,T> wideValue(value);
26 while (count >= VecSize) {
27 // Copy the value into the destination buffer (VecSize elements at a time)
28 wideValue.store(buffer);
29 buffer += VecSize;
30 count -= VecSize;
31 }
32 // If count was not an even multiple of VecSize, take care of the last few.
33 while (count-- > 0) {
34 *buffer++ = value;
35 }
36 }
37
38 /*not static*/ inline void memset16(uint16_t buffer[], uint16_t value, int count) {
40 }
41 /*not static*/ inline void memset32(uint32_t buffer[], uint32_t value, int count) {
43 }
44 /*not static*/ inline void memset64(uint64_t buffer[], uint64_t value, int count) {
46 }
47
48 template <typename T>
49 static void rect_memsetT(T buffer[], T value, int count, size_t rowBytes, int height) {
50 while (height --> 0) {
52 buffer = (T*)((char*)buffer + rowBytes);
53 }
54 }
55
56 /*not static*/ inline void rect_memset16(uint16_t buffer[], uint16_t value, int count,
57 size_t rowBytes, int height) {
58 rect_memsetT(buffer, value, count, rowBytes, height);
59 }
60 /*not static*/ inline void rect_memset32(uint32_t buffer[], uint32_t value, int count,
61 size_t rowBytes, int height) {
62 rect_memsetT(buffer, value, count, rowBytes, height);
63 }
64 /*not static*/ inline void rect_memset64(uint64_t buffer[], uint64_t value, int count,
65 size_t rowBytes, int height) {
66 rect_memsetT(buffer, value, count, rowBytes, height);
67 }
68
69} // namespace SK_OPTS_NS
70
71#endif//SkUtils_opts_DEFINED
int count
Definition: FontMgrTest.cpp:50
uint8_t value
void memset32(uint32_t buffer[], uint32_t value, int count)
Definition: SkMemset_opts.h:41
static void rect_memsetT(T buffer[], T value, int count, size_t rowBytes, int height)
Definition: SkMemset_opts.h:49
static void memsetT(T buffer[], T value, int count)
Definition: SkMemset_opts.h:17
void rect_memset16(uint16_t buffer[], uint16_t value, int count, size_t rowBytes, int height)
Definition: SkMemset_opts.h:56
void memset64(uint64_t buffer[], uint64_t value, int count)
Definition: SkMemset_opts.h:44
void rect_memset64(uint64_t buffer[], uint64_t value, int count, size_t rowBytes, int height)
Definition: SkMemset_opts.h:64
void memset16(uint16_t buffer[], uint16_t value, int count)
Definition: SkMemset_opts.h:38
void rect_memset32(uint32_t buffer[], uint32_t value, int count, size_t rowBytes, int height)
Definition: SkMemset_opts.h:60
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
#define T
Definition: precompiler.cc:65
int32_t height
Definition: SkVx.h:83
SKVX_ALWAYS_INLINE void store(void *ptr) const
Definition: SkVx.h:112