[PATCH 6 of 8 faster-obsmarkers] getbefloat64: drop unnecessary memcpy
Augie Fackler
raf at durin42.com
Mon Feb 2 10:01:27 CST 2015
# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1421790379 28800
# Tue Jan 20 13:46:19 2015 -0800
# Branch stable
# Node ID 22d73e82c50d1126c7640d960cf74fcf328add6c
# Parent bbd5e20889d06d6dccc8b3e83946d65d0cc79570
getbefloat64: drop unnecessary memcpy
diff --git a/mercurial/util.h b/mercurial/util.h
--- a/mercurial/util.h
+++ b/mercurial/util.h
@@ -199,14 +199,12 @@ static inline void putbe32(uint32_t x, c
static inline double getbefloat64(const char *c)
{
const unsigned char *d = (const unsigned char *)c;
- double ret;
int i;
uint64_t t = 0;
for (i = 0; i < 8; i++) {
t = (t<<8) + d[i];
}
- memcpy(&ret, &t, sizeof(t));
- return ret;
+ return *((const double*)&t);
}
#endif /* _HG_UTIL_H_ */
More information about the Mercurial-devel
mailing list