Remove more assumptions that pointers are 32-bit.

Change-Id: I2157e2fc4db7692b746c697982c3d028a056462a
This commit is contained in:
Elliott Hughes
2013-10-01 17:25:28 -07:00
parent b2acd5ded1
commit 405f8553cf
3 changed files with 21 additions and 20 deletions

View File

@@ -239,7 +239,8 @@ void* pthread_getspecific(pthread_key_t key) {
// 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 @@ int pthread_setspecific(pthread_key_t key, const void* ptr) {
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;
}