diff options
author | Alexander Amelkin <alexander@amelkin.msk.ru> | 2019-05-27 20:07:58 +0300 |
---|---|---|
committer | Alexander Amelkin <mocbuhtig@amelkin.msk.ru> | 2019-06-10 13:56:31 +0300 |
commit | c9510635d777c6d231dbca91af527bd3afdafdd7 (patch) | |
tree | a6cad279b057f59df3c09483f9770062e507b066 | |
parent | e11f463b4ea988dfe4314b2fd3d9c91315f10965 (diff) | |
download | ipmitool-c9510635d777c6d231dbca91af527bd3afdafdd7.tar.gz |
Add a helper htoipmi24() function
The function converts a host 32-bit integer into an IPMI
24-bit value (LSB first).
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
-rw-r--r-- | include/ipmitool/helper.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/ipmitool/helper.h b/include/ipmitool/helper.h index ccb538c..1da83fb 100644 --- a/include/ipmitool/helper.h +++ b/include/ipmitool/helper.h @@ -169,6 +169,13 @@ static inline uint32_t ipmi24toh(void *ipmi24) return h; } +static inline void htoipmi24(uint32_t h, uint8_t *ipmi) +{ + ipmi[0] = h & 0xFF; /* LSB */ + ipmi[1] = (h >> 8) & 0xFF; + ipmi[2] = (h >> 16) & 0xFF; /* MSB */ +} + static inline uint32_t ipmi32toh(void *ipmi32) { uint8_t *ipmi = ipmi32; |