From 52982c01a596284b00cd9d0a4addcb6b73eed9cd Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Mon, 7 Mar 2022 20:24:48 +1300 Subject: [PATCH] compression: Make use of PUSH_LE_Uxx macros Signed-off-by: Joseph Sutton Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- lib/compression/lzxpress.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/compression/lzxpress.c b/lib/compression/lzxpress.c index c962ba03490..222a5119c9f 100644 --- a/lib/compression/lzxpress.c +++ b/lib/compression/lzxpress.c @@ -177,19 +177,14 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed, if (match_len < (1 << 16)) { CHECK_OUTPUT_BYTES(sizeof(uint16_t)); - compressed[compressed_pos] = match_len & 0xFF; - compressed[compressed_pos + 1] = (match_len >> 8); + PUSH_LE_U16(compressed, compressed_pos, match_len); compressed_pos += sizeof(uint16_t); } else { CHECK_OUTPUT_BYTES(sizeof(uint16_t) + sizeof(uint32_t)); - compressed[compressed_pos] = 0; - compressed[compressed_pos + 1] = 0; + PUSH_LE_U16(compressed, compressed_pos, 0); compressed_pos += sizeof(uint16_t); - compressed[compressed_pos] = match_len & 0xFF; - compressed[compressed_pos + 1] = (match_len >> 8) & 0xFF; - compressed[compressed_pos + 2] = (match_len >> 16) & 0xFF; - compressed[compressed_pos + 3] = (match_len >> 24) & 0xFF; + PUSH_LE_U32(compressed, compressed_pos, match_len); compressed_pos += sizeof(uint32_t); } }