summaryrefslogtreecommitdiffstatshomepage
path: root/lib/libc
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-12-31 14:11:18 +0000
committerDamien George <damien.p.george@gmail.com>2015-12-31 14:11:18 +0000
commit64ececb72fe8ccf769f4751cbd591fde650bc83a (patch)
treea02b9a0ec2775da7cc5162b72e234d0a49c06f51 /lib/libc
parent8c936edeb279ab9970130f97725ab300e3f3add4 (diff)
downloadmicropython-64ececb72fe8ccf769f4751cbd591fde650bc83a.tar.gz
micropython-64ececb72fe8ccf769f4751cbd591fde650bc83a.zip
lib/libc/string0: Use uintptr_t instead of uint32_t.
This makes the code portable to non-32-bit architectures.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/string0.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/string0.c b/lib/libc/string0.c
index 8ba118b705..1b37169edd 100644
--- a/lib/libc/string0.c
+++ b/lib/libc/string0.c
@@ -30,7 +30,7 @@
#define likely(x) __builtin_expect((x), 1)
void *memcpy(void *dst, const void *src, size_t n) {
- if (likely(!(((uint32_t)dst) & 3) && !(((uint32_t)src) & 3))) {
+ if (likely(!(((uintptr_t)dst) & 3) && !(((uintptr_t)src) & 3))) {
// pointers aligned
uint32_t *d = dst;
const uint32_t *s = src;
@@ -80,7 +80,7 @@ void *memmove(void *dest, const void *src, size_t n) {
}
void *memset(void *s, int c, size_t n) {
- if (c == 0 && ((uint32_t)s & 3) == 0) {
+ if (c == 0 && ((uintptr_t)s & 3) == 0) {
// aligned store of 0
uint32_t *s32 = s;
for (size_t i = n >> 2; i > 0; i--) {