Stefan Schuermans commited on 2012-03-24 22:41:56
Showing 1 changed files, with 4 additions and 3 deletions.
... | ... |
@@ -18,12 +18,13 @@ void memcpy(void *dest, const void *src, unsigned int sz) |
18 | 18 |
if (((unsigned int)dest & 3) == 0 && ((unsigned int)src & 3) == 0) { |
19 | 19 |
dest4 = dest; |
20 | 20 |
src4 = src; |
21 |
- for (sz4 = sz >> 2; sz4 > 0; --sz4) |
|
21 |
+ sz4 = sz >> 2; |
|
22 |
+ for ( ; sz4 > 0; --sz4) |
|
22 | 23 |
*dest4++ = *src4++; |
24 |
+ // there might still be a few bytes to copy now |
|
23 | 25 |
dest = dest4; |
24 | 26 |
src = src4; |
25 |
- sz -= sz4; |
|
26 |
- // there might still be a few bytes to copy now |
|
27 |
+ sz &= 3; |
|
27 | 28 |
} |
28 | 29 |
|
29 | 30 |
// safe and slow fallback: copy byte-wise |
30 | 31 |