diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2022-11-01 19:21:35 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2022-11-11 20:10:05 +0000 |
commit | aca3707bd8848a568dff190e155a7da31b8b5aa4 (patch) | |
tree | 93d0bf4f9ecf7d25135cc3d5477e87d7974ddddf /src/helper | |
parent | 3ca7bc7354ea3f8db8384142c2bd8675789e7888 (diff) | |
download | riscv-openocd-aca3707bd8848a568dff190e155a7da31b8b5aa4.zip riscv-openocd-aca3707bd8848a568dff190e155a7da31b8b5aa4.tar.gz riscv-openocd-aca3707bd8848a568dff190e155a7da31b8b5aa4.tar.bz2 |
helper/types: use unsigned type for all h_u64_to_le() and similar
All the converters functions:
h_u64_to_le()
h_u64_to_be()
h_u32_to_le()
h_u32_to_be()
h_u24_to_le()
h_u24_to_be()
h_u16_to_le()
h_u16_to_be()
have signed type in their prototype, while the function name and
all the current use cases pass an unsigned value.
Change the prototypes to use unsigned types.
Change-Id: I76dcfdd7912b81f60902184712b2907eae9843f7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7299
Tested-by: jenkins
Diffstat (limited to 'src/helper')
-rw-r--r-- | src/helper/types.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/helper/types.h b/src/helper/types.h index b99ece1..587ed22 100644 --- a/src/helper/types.h +++ b/src/helper/types.h @@ -151,7 +151,7 @@ static inline uint16_t be_to_h_u16(const uint8_t *buf) return (uint16_t)((uint16_t)buf[1] | (uint16_t)buf[0] << 8); } -static inline void h_u64_to_le(uint8_t *buf, int64_t val) +static inline void h_u64_to_le(uint8_t *buf, uint64_t val) { buf[7] = (uint8_t) (val >> 56); buf[6] = (uint8_t) (val >> 48); @@ -163,7 +163,7 @@ static inline void h_u64_to_le(uint8_t *buf, int64_t val) buf[0] = (uint8_t) (val >> 0); } -static inline void h_u64_to_be(uint8_t *buf, int64_t val) +static inline void h_u64_to_be(uint8_t *buf, uint64_t val) { buf[0] = (uint8_t) (val >> 56); buf[1] = (uint8_t) (val >> 48); @@ -175,7 +175,7 @@ static inline void h_u64_to_be(uint8_t *buf, int64_t val) buf[7] = (uint8_t) (val >> 0); } -static inline void h_u32_to_le(uint8_t *buf, int val) +static inline void h_u32_to_le(uint8_t *buf, uint32_t val) { buf[3] = (uint8_t) (val >> 24); buf[2] = (uint8_t) (val >> 16); @@ -183,7 +183,7 @@ static inline void h_u32_to_le(uint8_t *buf, int val) buf[0] = (uint8_t) (val >> 0); } -static inline void h_u32_to_be(uint8_t *buf, int val) +static inline void h_u32_to_be(uint8_t *buf, uint32_t val) { buf[0] = (uint8_t) (val >> 24); buf[1] = (uint8_t) (val >> 16); @@ -191,27 +191,27 @@ static inline void h_u32_to_be(uint8_t *buf, int val) buf[3] = (uint8_t) (val >> 0); } -static inline void h_u24_to_le(uint8_t *buf, int val) +static inline void h_u24_to_le(uint8_t *buf, unsigned int val) { buf[2] = (uint8_t) (val >> 16); buf[1] = (uint8_t) (val >> 8); buf[0] = (uint8_t) (val >> 0); } -static inline void h_u24_to_be(uint8_t *buf, int val) +static inline void h_u24_to_be(uint8_t *buf, unsigned int val) { buf[0] = (uint8_t) (val >> 16); buf[1] = (uint8_t) (val >> 8); buf[2] = (uint8_t) (val >> 0); } -static inline void h_u16_to_le(uint8_t *buf, int val) +static inline void h_u16_to_le(uint8_t *buf, uint16_t val) { buf[1] = (uint8_t) (val >> 8); buf[0] = (uint8_t) (val >> 0); } -static inline void h_u16_to_be(uint8_t *buf, int val) +static inline void h_u16_to_be(uint8_t *buf, uint16_t val) { buf[0] = (uint8_t) (val >> 8); buf[1] = (uint8_t) (val >> 0); |