[PATCH 7 of 8 faster-obsmarkers] getbeint16: write in terms of getbeuint16

Augie Fackler raf at durin42.com
Mon Feb 2 10:01:28 CST 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1421791151 28800
#      Tue Jan 20 13:59:11 2015 -0800
# Branch stable
# Node ID 6969fa0e9ab6ae8c4642ea1f90e9374e4e5a9b28
# Parent  22d73e82c50d1126c7640d960cf74fcf328add6c
getbeint16: write in terms of getbeuint16

diff --git a/mercurial/util.h b/mercurial/util.h
--- a/mercurial/util.h
+++ b/mercurial/util.h
@@ -172,7 +172,7 @@ static inline uint32_t getbe32(const cha
 		(d[3]));
 }
 
-static inline int16_t getbeint16(const char *c)
+static inline uint16_t getbeuint16(const char *c)
 {
 	const unsigned char *d = (const unsigned char *)c;
 
@@ -180,12 +180,9 @@ static inline int16_t getbeint16(const c
 		(d[1]));
 }
 
-static inline uint16_t getbeuint16(const char *c)
+static inline int16_t getbeint16(const char *c)
 {
-	const unsigned char *d = (const unsigned char *)c;
-
-	return ((d[0] << 8) |
-		(d[1]));
+	return (int16_t)getbeuint16(c);
 }
 
 static inline void putbe32(uint32_t x, char *c)


More information about the Mercurial-devel mailing list