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

Side by Side Diff: src/core/SkUtils.cpp

Issue 292663013: sk_memcpy32 should fall back on libc memcpy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkUtils.h" 10 #include "SkUtils.h"
(...skipping 16 matching lines...) Expand all
27 do { \ 27 do { \
28 *(dst)++ = value; *(dst)++ = value; \ 28 *(dst)++ = value; *(dst)++ = value; \
29 *(dst)++ = value; *(dst)++ = value; \ 29 *(dst)++ = value; *(dst)++ = value; \
30 *(dst)++ = value; *(dst)++ = value; \ 30 *(dst)++ = value; *(dst)++ = value; \
31 *(dst)++ = value; *(dst)++ = value; \ 31 *(dst)++ = value; *(dst)++ = value; \
32 *(dst)++ = value; *(dst)++ = value; \ 32 *(dst)++ = value; *(dst)++ = value; \
33 *(dst)++ = value; *(dst)++ = value; \ 33 *(dst)++ = value; *(dst)++ = value; \
34 *(dst)++ = value; *(dst)++ = value; \ 34 *(dst)++ = value; *(dst)++ = value; \
35 *(dst)++ = value; *(dst)++ = value; \ 35 *(dst)++ = value; *(dst)++ = value; \
36 } while (0) 36 } while (0)
37
38 #define copy_16_longs(dst, src) \
39 do { \
40 *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
41 *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
42 *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
43 *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
44 *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
45 *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
46 *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
47 *(dst)++ = *(src)++; *(dst)++ = *(src)++; \
48 } while (0)
49 #endif 37 #endif
50 38
51 /////////////////////////////////////////////////////////////////////////////// 39 ///////////////////////////////////////////////////////////////////////////////
52 40
53 static void sk_memset16_portable(uint16_t dst[], uint16_t value, int count) { 41 static void sk_memset16_portable(uint16_t dst[], uint16_t value, int count) {
54 SkASSERT(dst != NULL && count >= 0); 42 SkASSERT(dst != NULL && count >= 0);
55 43
56 if (count <= 0) { 44 if (count <= 0) {
57 return; 45 return;
58 } 46 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 103 }
116 104
117 if (count) { 105 if (count) {
118 do { 106 do {
119 *dst++ = value; 107 *dst++ = value;
120 } while (--count != 0); 108 } while (--count != 0);
121 } 109 }
122 } 110 }
123 111
124 static void sk_memcpy32_portable(uint32_t dst[], const uint32_t src[], int count ) { 112 static void sk_memcpy32_portable(uint32_t dst[], const uint32_t src[], int count ) {
125 SkASSERT(dst != NULL && count >= 0); 113 memcpy(dst, src, count * sizeof(uint32_t));
126
127 int sixteenlongs = count >> 4;
128 if (sixteenlongs) {
129 do {
130 copy_16_longs(dst, src);
131 } while (--sixteenlongs != 0);
132 count &= 15;
133 }
134
135 if (count) {
136 do {
137 *dst++ = *src++;
138 } while (--count != 0);
139 }
140 } 114 }
141 115
142 static void choose_memset16(SkMemset16Proc* proc) { 116 static void choose_memset16(SkMemset16Proc* proc) {
143 *proc = SkMemset16GetPlatformProc(); 117 *proc = SkMemset16GetPlatformProc();
144 if (NULL == *proc) { 118 if (NULL == *proc) {
145 *proc = &sk_memset16_portable; 119 *proc = &sk_memset16_portable;
146 } 120 }
147 } 121 }
148 122
149 void sk_memset16(uint16_t dst[], uint16_t value, int count) { 123 void sk_memset16(uint16_t dst[], uint16_t value, int count) {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 425 }
452 } else { 426 } else {
453 char* start = utf8; 427 char* start = utf8;
454 while (utf16 < stop) { 428 while (utf16 < stop) {
455 utf8 += SkUTF8_FromUnichar(SkUTF16_NextUnichar(&utf16), utf8); 429 utf8 += SkUTF8_FromUnichar(SkUTF16_NextUnichar(&utf16), utf8);
456 } 430 }
457 size = utf8 - start; 431 size = utf8 - start;
458 } 432 }
459 return size; 433 return size;
460 } 434 }
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