Remove more assumptions that pointers are 32-bit.
Change-Id: I2157e2fc4db7692b746c697982c3d028a056462a
diff --git a/libc/bionic/pthread_key.cpp b/libc/bionic/pthread_key.cpp
index 2ae6519..7e8b4cd 100644
--- a/libc/bionic/pthread_key.cpp
+++ b/libc/bionic/pthread_key.cpp
@@ -239,7 +239,8 @@
// to check that the key is properly allocated. If the key was not
// allocated, the value read from the TLS should always be NULL
// due to pthread_key_delete() clearing the values for all threads.
- return (void *)(((unsigned *)__get_tls())[key]);
+ uintptr_t address = reinterpret_cast<volatile uintptr_t*>(__get_tls())[key];
+ return reinterpret_cast<void*>(address);
}
int pthread_setspecific(pthread_key_t key, const void* ptr) {
@@ -249,6 +250,6 @@
return EINVAL;
}
- ((uint32_t *)__get_tls())[key] = (uint32_t)ptr;
+ reinterpret_cast<volatile uintptr_t*>(__get_tls())[key] = reinterpret_cast<uintptr_t>(ptr);
return 0;
}