libgphoto2/byteswap.diff

39 lines
2.4 KiB
Diff

--- libgphoto2_port/m4/gp-byteorder.m4
+++ libgphoto2_port/m4/gp-byteorder.m4
@@ -322,12 +322,12 @@ EOF
/* Non-optimized but portable macros */
#define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1]))
#define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3]))
-#define be64atoh(x) ((uint64_t)(((x)[0]<<56)|((x)[1]<<48)|((x)[2]<<40)| \\
- ((x)[3]<<32)|((x)[4]<<24)|((x)[5]<<16)|((x)[6]<<8)|(x)[7]))
+#define be64atoh(x) ((((uint64_t)(x)[0]<<56)|((uint64_t)(x)[1]<<48)|((uint64_t)(x)[2]<<40)| \\
+ ((uint64_t)(x)[3]<<32)|((x)[4]<<24)|((x)[5]<<16)|((x)[6]<<8)|(x)[7]))
#define le16atoh(x) ((uint16_t)(((x)[1]<<8)|(x)[0]))
#define le32atoh(x) ((uint32_t)(((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
-#define le64atoh(x) ((uint64_t)(((x)[7]<<56)|((x)[6]<<48)|((x)[5]<<40)| \\
- ((x)[4]<<32)|((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
+#define le64atoh(x) ((((uint64_t)(x)[7]<<56)|((uint64_t)(x)[6]<<48)|((uint64_t)(x)[5]<<40)| \\
+ ((uint64_t)(x)[4]<<32)|((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
#define htobe16a(a,x) (a)[0]=(uint8_t)((x)>>8), (a)[1]=(uint8_t)(x)
#define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\
--- m4m/gp-byteorder.m4
+++ m4m/gp-byteorder.m4
@@ -322,12 +322,12 @@ EOF
/* Non-optimized but portable macros */
#define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1]))
#define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3]))
-#define be64atoh(x) ((uint64_t)(((x)[0]<<56)|((x)[1]<<48)|((x)[2]<<40)| \\
- ((x)[3]<<32)|((x)[4]<<24)|((x)[5]<<16)|((x)[6]<<8)|(x)[7]))
+#define be64atoh(x) ((((uint64_t)(x)[0]<<56)|((uint64_t)(x)[1]<<48)|((uint64_t)(x)[2]<<40)| \\
+ ((uint64_t)(x)[3]<<32)|((x)[4]<<24)|((x)[5]<<16)|((x)[6]<<8)|(x)[7]))
#define le16atoh(x) ((uint16_t)(((x)[1]<<8)|(x)[0]))
#define le32atoh(x) ((uint32_t)(((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
-#define le64atoh(x) ((uint64_t)(((x)[7]<<56)|((x)[6]<<48)|((x)[5]<<40)| \\
- ((x)[4]<<32)|((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
+#define le64atoh(x) ((((uint64_t)(x)[7]<<56)|((uint64_t)(x)[6]<<48)|((uint64_t)(x)[5]<<40)| \\
+ ((uint64_t)(x)[4]<<32)|((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
#define htobe16a(a,x) (a)[0]=(uint8_t)((x)>>8), (a)[1]=(uint8_t)(x)
#define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\