From: Joseph Sutton Date: Thu, 30 Nov 2023 02:00:08 +0000 (+1300) Subject: lib:util: Remove redundant casts in PUSH_*() macros X-Git-Tag: talloc-2.4.2~227 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a334ad85b820eb1613a0b58e71814bdf54f22f95;p=thirdparty%2Fsamba.git lib:util: Remove redundant casts in PUSH_*() macros The PUSH_*() macros already cast their arguments to the expected type, so we don’t need to cast the arguments *again* prior to invoking the macros. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/lib/util/bytearray.h b/lib/util/bytearray.h index ec5b7a01c63..0af8a82c2c1 100644 --- a/lib/util/bytearray.h +++ b/lib/util/bytearray.h @@ -59,17 +59,17 @@ PUSH_LE_U8(data, pos, val) #define PUSH_LE_U16(data, pos, val) \ - (PUSH_LE_U8(data, pos, (uint8_t)((uint16_t)(val) & 0xff)), PUSH_LE_U8(data, (pos) + 1, (uint8_t)((uint16_t)(val) >> 8))) + (PUSH_LE_U8(data, pos, (uint16_t)(val) & 0xff), PUSH_LE_U8(data, (pos) + 1, (uint16_t)(val) >> 8)) #define PUSH_LE_I16(data, pos, val) \ PUSH_LE_U16(data, pos, val) #define PUSH_LE_U32(data, pos, val) \ - (PUSH_LE_U16(data, pos, (uint16_t)((uint32_t)(val) & 0xffff)), PUSH_LE_U16(data, (pos) + 2, (uint16_t)((uint32_t)(val) >> 16))) + (PUSH_LE_U16(data, pos, (uint32_t)(val) & 0xffff), PUSH_LE_U16(data, (pos) + 2, (uint32_t)(val) >> 16)) #define PUSH_LE_I32(data, pos, val) \ PUSH_LE_U32(data, pos, val) #define PUSH_LE_U64(data, pos, val) \ - (PUSH_LE_U32(data, pos, (uint32_t)((uint64_t)(val) & 0xffffffff)), PUSH_LE_U32(data, (pos) + 4, (uint32_t)((uint64_t)(val) >> 32))) + (PUSH_LE_U32(data, pos, (uint64_t)(val) & 0xffffffff), PUSH_LE_U32(data, (pos) + 4, (uint64_t)(val) >> 32)) #define PUSH_LE_I64(data, pos, val) \ PUSH_LE_U64(data, pos, val) @@ -107,17 +107,17 @@ PUSH_BE_U8(data, pos, val) #define PUSH_BE_U16(data, pos, val) \ - (PUSH_BE_U8(data, pos, (uint8_t)(((uint16_t)(val)) >> 8)), PUSH_BE_U8(data, (pos) + 1, (uint8_t)((uint16_t)(val) & 0xff))) + (PUSH_BE_U8(data, pos, ((uint16_t)(val)) >> 8), PUSH_BE_U8(data, (pos) + 1, (uint16_t)(val) & 0xff)) #define PUSH_BE_I16(data, pos, val) \ PUSH_BE_U16(data, pos, val) #define PUSH_BE_U32(data, pos, val) \ - (PUSH_BE_U16(data, pos, (uint16_t)(((uint32_t)(val)) >> 16)), PUSH_BE_U16(data, (pos) + 2, (uint16_t)((uint32_t)(val) & 0xffff))) + (PUSH_BE_U16(data, pos, (uint32_t)(val) >> 16), PUSH_BE_U16(data, (pos) + 2, (uint32_t)(val) & 0xffff)) #define PUSH_BE_I32(data, pos, val) \ PUSH_BE_U32(data, pos, val) #define PUSH_BE_U64(data, pos, val) \ - (PUSH_BE_U32(data, pos, (uint32_t)(((uint64_t)(val)) >> 32)), PUSH_BE_U32(data, (pos) + 4, (uint32_t)((uint64_t)(val) & 0xffffffff))) + (PUSH_BE_U32(data, pos, (uint64_t)(val) >> 32), PUSH_BE_U32(data, (pos) + 4, (uint64_t)(val) & 0xffffffff)) #define PUSH_BE_I64(data, pos, val) \ PUSH_BE_U64(data, pos, val)