| * Copyright 2010 Tilera Corporation. All Rights Reserved. |
| * This program is free software; you can redistribute it and/or |
| * modify it under the terms of the GNU General Public License |
| * as published by the Free Software Foundation, version 2. |
| * This program is distributed in the hope that it will be useful, but |
| * WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
| * NON INFRINGEMENT. See the GNU General Public License for |
| #include <linux/string.h> |
| #include <linux/module.h> |
| void *memmove(void *dest, const void *src, size_t n) |
| if ((const char *)src >= (char *)dest + n |
| || (char *)dest >= (const char *)src + n) { |
| /* We found no overlap, so let memcpy do all the heavy |
| * lifting (prefetching, etc.) |
| return memcpy(dest, src, n); |
| in = (const uint8_t *)src + n - 1; |
| out = (uint8_t *)dest + n - 1; |
| in = (const uint8_t *)src; |
| /* Manually software-pipeline this loop. */ |