Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: include/core/SkUtils.h

Issue 1351403005: try simplest code: inline whenever vaguely sensible (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkUtils_DEFINED 8 #ifndef SkUtils_DEFINED
9 #define SkUtils_DEFINED 9 #define SkUtils_DEFINED
10 10
(...skipping 13 matching lines...) Expand all
24 // code was not helpful; it's got to be here outside. 24 // code was not helpful; it's got to be here outside.
25 // - NEON code generation for ARMv8 with GCC 4.9 is terrible, 25 // - NEON code generation for ARMv8 with GCC 4.9 is terrible,
26 // making the NEON code ~8x slower that just a serial loop. 26 // making the NEON code ~8x slower that just a serial loop.
27 27
28 /** Similar to memset(), but it assigns a 16bit value into the buffer. 28 /** Similar to memset(), but it assigns a 16bit value into the buffer.
29 @param buffer The memory to have value copied into it 29 @param buffer The memory to have value copied into it
30 @param value The 16bit value to be copied into buffer 30 @param value The 16bit value to be copied into buffer
31 @param count The number of times value should be copied into the buffer. 31 @param count The number of times value should be copied into the buffer.
32 */ 32 */
33 static inline void sk_memset16(uint16_t buffer[], uint16_t value, int count) { 33 static inline void sk_memset16(uint16_t buffer[], uint16_t value, int count) {
34 #if defined(SK_CPU_ARM64) 34 #if defined(SK_ARM_HAS_NEON) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
35 while (count --> 0) { *buffer++ = value; } return; 35 while (count --> 0) { *buffer++ = value; }
36 #elif defined(SK_CPU_ARM32) 36 #else
37 if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; } 37 SkOpts::memset16(buffer, value, count);
38 #endif 38 #endif
39 SkOpts::memset16(buffer, value, count);
40 } 39 }
41 40
42 /** Similar to memset(), but it assigns a 32bit value into the buffer. 41 /** Similar to memset(), but it assigns a 32bit value into the buffer.
43 @param buffer The memory to have value copied into it 42 @param buffer The memory to have value copied into it
44 @param value The 32bit value to be copied into buffer 43 @param value The 32bit value to be copied into buffer
45 @param count The number of times value should be copied into the buffer. 44 @param count The number of times value should be copied into the buffer.
46 */ 45 */
47 static inline void sk_memset32(uint32_t buffer[], uint32_t value, int count) { 46 static inline void sk_memset32(uint32_t buffer[], uint32_t value, int count) {
48 #if defined(SK_CPU_ARM64) 47 #if defined(SK_ARM_HAS_NEON) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
49 while (count --> 0) { *buffer++ = value; } return; 48 while (count --> 0) { *buffer++ = value; }
50 #elif defined(SK_CPU_ARM32) 49 #else
51 if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; } 50 SkOpts::memset32(buffer, value, count);
52 #endif 51 #endif
53 SkOpts::memset32(buffer, value, count);
54 } 52 }
55 53
56 54
57 /////////////////////////////////////////////////////////////////////////////// 55 ///////////////////////////////////////////////////////////////////////////////
58 56
59 #define kMaxBytesInUTF8Sequence 4 57 #define kMaxBytesInUTF8Sequence 4
60 58
61 #ifdef SK_DEBUG 59 #ifdef SK_DEBUG
62 int SkUTF8_LeadByteToCount(unsigned c); 60 int SkUTF8_LeadByteToCount(unsigned c);
63 #else 61 #else
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 122 }
125 ~SkAutoTrace() { 123 ~SkAutoTrace() {
126 SkDebugf("--- trace: %s Leave\n", fLabel); 124 SkDebugf("--- trace: %s Leave\n", fLabel);
127 } 125 }
128 private: 126 private:
129 const char* fLabel; 127 const char* fLabel;
130 }; 128 };
131 #define SkAutoTrace(...) SK_REQUIRE_LOCAL_VAR(SkAutoTrace) 129 #define SkAutoTrace(...) SK_REQUIRE_LOCAL_VAR(SkAutoTrace)
132 130
133 #endif 131 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698