We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1726bba commit 64f4938Copy full SHA for 64f4938
jerry-libc/jerry-libc.c
@@ -103,6 +103,24 @@ memcpy (void *s1, /**< destination */
103
const void *s2, /**< source */
104
size_t n) /**< bytes number */
105
{
106
+ /* Aligned fast case. */
107
+ if (n >= 4 && !(((uintptr_t) s1) & 0x3) && !(((uintptr_t) s2) & 0x3))
108
+ {
109
+ size_t chunks = (n >> 2);
110
+ uint32_t *area1_p = (uint32_t *) s1;
111
+ const uint32_t *area2_p = (const uint32_t *) s2;
112
+
113
+ do
114
115
+ *area1_p++ = *area2_p++;
116
+ }
117
+ while (--chunks);
118
119
+ n &= 0x3;
120
+ s1 = area1_p;
121
+ s2 = area2_p;
122
123
124
uint8_t *area1_p = (uint8_t *) s1;
125
const uint8_t *area2_p = (const uint8_t *) s2;
126
0 commit comments