Chromium Code Reviews| Index: src/utils.h |
| diff --git a/src/utils.h b/src/utils.h |
| index 525c6f87d3d96fbd8504a00474981675c1c1f74d..b7415226a7f82de46f317646b8a25c9d17303b60 100644 |
| --- a/src/utils.h |
| +++ b/src/utils.h |
| @@ -1324,6 +1324,9 @@ INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, int chars)); |
| #elif defined(V8_HOST_ARCH_MIPS) |
| INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, int chars)); |
| INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, int chars)); |
| +#elif defined(V8_HOST_ARCH_PPC) |
| +INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, int chars)); |
| +INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, int chars)); |
| #endif |
| // Copy from 8bit/16bit chars to 8bit/16bit chars. |
| @@ -1483,6 +1486,136 @@ void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, int chars) { |
| MemCopy(dest, src, chars * sizeof(*dest)); |
| } |
| } |
| +#elif defined(V8_HOST_ARCH_PPC) |
| +#define CASE(n) \ |
| + case n: \ |
| + memcpy(dest, src, n); \ |
| + break |
| +void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, int chars) { |
|
Sven Panne
2015/01/08 10:13:53
Do we really need this huge switch (and below)? Do
michael_dawson
2015/01/08 23:51:11
We don't have the concrete numbers anymore but the
|
| + switch (static_cast<unsigned>(chars)) { |
| + case 0: |
| + break; |
| + case 1: |
| + *dest = *src; |
| + break; |
| + CASE(2); |
| + CASE(3); |
| + CASE(4); |
| + CASE(5); |
| + CASE(6); |
| + CASE(7); |
| + CASE(8); |
| + CASE(9); |
| + CASE(10); |
| + CASE(11); |
| + CASE(12); |
| + CASE(13); |
| + CASE(14); |
| + CASE(15); |
| + CASE(16); |
| + CASE(17); |
| + CASE(18); |
| + CASE(19); |
| + CASE(20); |
| + CASE(21); |
| + CASE(22); |
| + CASE(23); |
| + CASE(24); |
| + CASE(25); |
| + CASE(26); |
| + CASE(27); |
| + CASE(28); |
| + CASE(29); |
| + CASE(30); |
| + CASE(31); |
| + CASE(32); |
| + CASE(33); |
| + CASE(34); |
| + CASE(35); |
| + CASE(36); |
| + CASE(37); |
| + CASE(38); |
| + CASE(39); |
| + CASE(40); |
| + CASE(41); |
| + CASE(42); |
| + CASE(43); |
| + CASE(44); |
| + CASE(45); |
| + CASE(46); |
| + CASE(47); |
| + CASE(48); |
| + CASE(49); |
| + CASE(50); |
| + CASE(51); |
| + CASE(52); |
| + CASE(53); |
| + CASE(54); |
| + CASE(55); |
| + CASE(56); |
| + CASE(57); |
| + CASE(58); |
| + CASE(59); |
| + CASE(60); |
| + CASE(61); |
| + CASE(62); |
| + CASE(63); |
| + CASE(64); |
| + default: |
| + memcpy(dest, src, chars); |
| + break; |
| + } |
| +} |
| +#undef CASE |
| + |
| +#define CASE(n) \ |
| + case n: \ |
| + memcpy(dest, src, n * 2); \ |
| + break |
| +void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, int chars) { |
| + switch (static_cast<unsigned>(chars)) { |
| + case 0: |
| + break; |
| + case 1: |
| + *dest = *src; |
| + break; |
| + CASE(2); |
| + CASE(3); |
| + CASE(4); |
| + CASE(5); |
| + CASE(6); |
| + CASE(7); |
| + CASE(8); |
| + CASE(9); |
| + CASE(10); |
| + CASE(11); |
| + CASE(12); |
| + CASE(13); |
| + CASE(14); |
| + CASE(15); |
| + CASE(16); |
| + CASE(17); |
| + CASE(18); |
| + CASE(19); |
| + CASE(20); |
| + CASE(21); |
| + CASE(22); |
| + CASE(23); |
| + CASE(24); |
| + CASE(25); |
| + CASE(26); |
| + CASE(27); |
| + CASE(28); |
| + CASE(29); |
| + CASE(30); |
| + CASE(31); |
| + CASE(32); |
| + default: |
| + memcpy(dest, src, chars * 2); |
| + break; |
| + } |
| +} |
| +#undef CASE |
| #endif |