No more memcpy needed when using arm compiler 6.3.1

This commit is contained in:
Bertrand Songis
2020-02-12 15:53:47 +01:00
parent 117b99991b
commit aca4f4f160
3 changed files with 1 additions and 45 deletions
-1
View File
@@ -901,7 +901,6 @@ void *stb_realloc(void *ptr, unsigned int oldsz, unsigned int newsz)
}
#endif // #if defined(TRACE_STB_MALLOC)
#include "memcpy.h"
#include "thirdparty/Stb/stb_image.h"
// fill 'data' with 'size' bytes. return number of bytes actually read
+1 -1
View File
@@ -249,7 +249,7 @@ class BitmapBuffer: public BitmapBufferBase<uint16_t>
, leakReported(false)
#endif
{
data = (uint16_t *)malloc(width*height*sizeof(uint16_t));
data = (uint16_t *)malloc(width * height * sizeof(uint16_t));
data_end = data + (width * height);
}
-43
View File
@@ -1,43 +0,0 @@
/*
* Copyright (C) OpenTX
*
* Source:
* https://github.com/opentx/libopenui
*
* This file is a part of libopenui library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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. See the GNU
* Lesser General Public License for more details.
*/
#ifndef _MEMCPY_H_
#define _MEMCPY_H_
#include <string.h>
#if !defined(SIMU)
inline void safeMemcpy(void * dest, const void * src, unsigned int size)
{
if (((uint32_t)dest & 0x03) || ((uint32_t)src & 0x03)) {
for (unsigned i = 0; i < size; i++) {
((uint8_t *)dest)[i] = ((uint8_t *)src)[i];
}
}
else {
memcpy(dest, src, size);
}
}
#define memcpy safeMemcpy
#endif
#endif // _HELPERS_H_