diff options
author | Mike Klein <mtklein@chromium.org> | 2017-01-04 14:44:20 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-24 18:01:16 +0000 |
commit | 57bc1e7bc804be4779dd09409046f62c4d43e3cd (patch) | |
tree | 039d2d3f2b9eb57d3ba2f9d4f68d0f25585335e6 | |
parent | aee504beb2185e7297b30c02a1541d1306196416 (diff) |
move sk_memset16,32,64 out-of-line
This helps pick it out on profiles and when debugging.
This will have a negligible impact on speed in most cases (small memsets are always fast, large memsets dwarf function call overhead), and clients like Chrome that use link-time optimization should see exactly zero impact.
This does however affect code size: it makes libskia 43K smaller on my laptop.
Change-Id: I55bdc75b7429a63024ab3b7d55dc1f886bde102a
Reviewed-on: https://skia-review.googlesource.com/6589
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
-rw-r--r-- | src/core/SkUtils.cpp | 16 | ||||
-rw-r--r-- | src/core/SkUtils.h | 34 |
2 files changed, 21 insertions, 29 deletions
diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp index 85ebb3e29c..311394d70c 100644 --- a/src/core/SkUtils.cpp +++ b/src/core/SkUtils.cpp @@ -8,6 +8,22 @@ #include "SkUtils.h" +void sk_memset16(uint16_t buffer[], uint16_t value, int count) { + for (int i = 0; i < count; i++) { + buffer[i] = value; + } +} +void sk_memset32(uint32_t buffer[], uint32_t value, int count) { + for (int i = 0; i < count; i++) { + buffer[i] = value; + } +} +void sk_memset64(uint64_t buffer[], uint64_t value, int count) { + for (int i = 0; i < count; i++) { + buffer[i] = value; + } +} + /* 0xxxxxxx 1 total 10xxxxxx // never a leading byte 110xxxxx 2 total diff --git a/src/core/SkUtils.h b/src/core/SkUtils.h index e24dd52f45..241a61ad2f 100644 --- a/src/core/SkUtils.h +++ b/src/core/SkUtils.h @@ -11,38 +11,14 @@ #include "SkTypes.h" #include "SkMath.h" -/** Similar to memset(), but it assigns a 16bit value into the buffer. +/** Similar to memset(), but it assigns a 16, 32, or 64-bit value into the buffer. @param buffer The memory to have value copied into it - @param value The 16bit value to be copied into buffer + @param value The value to be copied into buffer @param count The number of times value should be copied into the buffer. */ -static inline void sk_memset16(uint16_t buffer[], uint16_t value, int count) { - for (int i = 0; i < count; i++) { - buffer[i] = value; - } -} - -/** Similar to memset(), but it assigns a 32bit value into the buffer. - @param buffer The memory to have value copied into it - @param value The 32bit value to be copied into buffer - @param count The number of times value should be copied into the buffer. -*/ -static inline void sk_memset32(uint32_t buffer[], uint32_t value, int count) { - for (int i = 0; i < count; i++) { - buffer[i] = value; - } -} - -/** Similar to memset(), but it assigns a 64bit value into the buffer. - @param buffer The memory to have value copied into it - @param value The 64bit value to be copied into buffer - @param count The number of times value should be copied into the buffer. -*/ -static inline void sk_memset64(uint64_t buffer[], uint64_t value, int count) { - for (int i = 0; i < count; i++) { - buffer[i] = value; - } -} +void sk_memset16(uint16_t buffer[], uint16_t value, int count); +void sk_memset32(uint32_t buffer[], uint32_t value, int count); +void sk_memset64(uint64_t buffer[], uint64_t value, int count); /////////////////////////////////////////////////////////////////////////////// #define kMaxBytesInUTF8Sequence 4 |