diff options
author | Keun-young Park <keunyoung@google.com> | 2013-03-26 17:47:19 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-03-26 17:47:19 +0000 |
commit | cd91024ca16db96daa697e22f7a088b416a424e3 (patch) | |
tree | 6311129ed9b645b0eb2c05934feb002fb04de7ad /libs | |
parent | 20e154f16f315d7ae0b3204db0004d19a8b0bc48 (diff) | |
parent | cc1a4bb1e1da3f2f38bdaf1f76348c7bc9fb6adb (diff) | |
download | frameworks_native-cd91024ca16db96daa697e22f7a088b416a424e3.zip frameworks_native-cd91024ca16db96daa697e22f7a088b416a424e3.tar.gz frameworks_native-cd91024ca16db96daa697e22f7a088b416a424e3.tar.bz2 |
Merge "[MIPS] Avoid unaligned load/store for 64-bit doubles."
Diffstat (limited to 'libs')
-rw-r--r-- | libs/binder/Parcel.cpp | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 4c15913..8f7f7e7 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -627,11 +627,27 @@ status_t Parcel::writeFloat(float val) return writeAligned(val); } +#if defined(__mips__) && defined(__mips_hard_float) + +status_t Parcel::writeDouble(double val) +{ + union { + double d; + unsigned long long ll; + } u; + u.d = val; + return writeAligned(u.ll); +} + +#else + status_t Parcel::writeDouble(double val) { return writeAligned(val); } +#endif + status_t Parcel::writeIntPtr(intptr_t val) { return writeAligned(val); @@ -962,17 +978,44 @@ float Parcel::readFloat() const return readAligned<float>(); } +#if defined(__mips__) && defined(__mips_hard_float) + status_t Parcel::readDouble(double *pArg) const { - return readAligned(pArg); + union { + double d; + unsigned long long ll; + } u; + status_t status; + status = readAligned(&u.ll); + *pArg = u.d; + return status; } +double Parcel::readDouble() const +{ + union { + double d; + unsigned long long ll; + } u; + u.ll = readAligned<unsigned long long>(); + return u.d; +} + +#else + +status_t Parcel::readDouble(double *pArg) const +{ + return readAligned(pArg); +} double Parcel::readDouble() const { return readAligned<double>(); } +#endif + status_t Parcel::readIntPtr(intptr_t *pArg) const { return readAligned(pArg); |