1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Merge pull request #575 from h4rm0n1c/patch-3

Re-added lost function memcpy_P
This commit is contained in:
Ivan Grokhotkov 2015-07-22 17:15:34 +03:00
commit b6185c3ceb

View File

@ -26,6 +26,18 @@ size_t strnlen_P(PGM_P s, size_t size) {
return (size_t) (cp - s); return (size_t) (cp - s);
} }
void* memcpy_P(void* dest, PGM_VOID_P src, size_t count) {
const uint8_t* read = reinterpret_cast<const uint8_t*>(src);
uint8_t* write = reinterpret_cast<uint8_t*>(dest);
while (count)
{
*write++ = pgm_read_byte(read++);
count--;
}
return dest;
}
int memcmp_P(const void* buf1, PGM_VOID_P buf2P, size_t size) { int memcmp_P(const void* buf1, PGM_VOID_P buf2P, size_t size) {
int result = 0; int result = 0;