Chromium Code Reviews| Index: include/core/SkUtils.h |
| diff --git a/include/core/SkUtils.h b/include/core/SkUtils.h |
| index d522ae0dea139555f6e8790ac06d8287e5771fd7..c0e91eef9ff9f0a40b3d3c0d72632f8ecf4c2c3a 100644 |
| --- a/include/core/SkUtils.h |
| +++ b/include/core/SkUtils.h |
| @@ -17,7 +17,18 @@ |
| @param value The 16bit value to be copied into buffer |
| @param count The number of times value should be copied into the buffer. |
| */ |
| -void sk_memset16(uint16_t dst[], uint16_t value, int count); |
| +void sk_memset16_large(uint16_t dst[], uint16_t value, int count); |
|
reed1
2015/04/09 18:55:48
Seems like its not much harder to provide both N v
mtklein
2015/04/09 19:11:10
Good point! Done.
|
| +inline void sk_memset16(uint16_t dst[], uint16_t value, int count) { |
| + // 10 determined empirically using bench/MemsetBench.cpp on a Nexus 7, Nexus 9, and desktop. |
| + // (N7 was the limiting factor; desktops and N9 consider 10,000 small but 100,000 large). |
| + if (count <= 10) { |
| + for (int i = 0; i < count; i++) { |
| + dst[i] = value; |
| + } |
| + } else { |
| + sk_memset16_large(dst, value, count); |
| + } |
| +} |
| typedef void (*SkMemset16Proc)(uint16_t dst[], uint16_t value, int count); |
| SkMemset16Proc SkMemset16GetPlatformProc(); |
| @@ -26,7 +37,19 @@ SkMemset16Proc SkMemset16GetPlatformProc(); |
| @param value The 32bit value to be copied into buffer |
| @param count The number of times value should be copied into the buffer. |
| */ |
| -void sk_memset32(uint32_t dst[], uint32_t value, int count); |
| +void sk_memset32_large(uint32_t dst[], uint32_t value, int count); |
| +inline void sk_memset32(uint32_t dst[], uint32_t value, int count) { |
| + // 10 determined empirically using bench/MemsetBench.cpp on a Nexus 7, Nexus 9, and desktop. |
| + // (N7 was the limiting factor; desktops and N9 consider 10,000 small but 100,000 large). |
| + if (count <= 10) { |
| + for (int i = 0; i < count; i++) { |
| + dst[i] = value; |
| + } |
| + } else { |
| + sk_memset32_large(dst, value, count); |
| + } |
| +} |
| + |
| typedef void (*SkMemset32Proc)(uint32_t dst[], uint32_t value, int count); |
| SkMemset32Proc SkMemset32GetPlatformProc(); |