mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
make this function a macro
This commit is contained in:
parent
54d6016a31
commit
b3472220af
@ -48,7 +48,8 @@
|
||||
#include <ipmitool/ipmi_entity.h>
|
||||
|
||||
int ipmi_sdr_main(struct ipmi_intf *, int, char **);
|
||||
int32_t utos(uint32_t val, int bits);
|
||||
|
||||
#define utos(val, bits) ((val & ((1<<(bits)-1))) ? (-((~(val) & ((1<<(bits)-1) - 1)) + 1)) : (val))
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
# define __TO_TOL(mtol) (uint16_t)(mtol & 0x3f)
|
||||
|
@ -65,24 +65,6 @@ static struct sdr_record_list *sdr_list_head = NULL;
|
||||
static struct sdr_record_list *sdr_list_tail = NULL;
|
||||
static struct ipmi_sdr_iterator *sdr_list_itr = NULL;
|
||||
|
||||
/* utos - convert unsigned 32bit value to 2's complement signed
|
||||
*
|
||||
* @val: unsigned value to convert
|
||||
* @bits: number of bits in value
|
||||
*
|
||||
* returns 2s complement signed integer
|
||||
*/
|
||||
int32_t
|
||||
utos(uint32_t val, int bits)
|
||||
{
|
||||
int x = 1<<(bits-1);
|
||||
|
||||
if (val & x)
|
||||
return -((~val & ((1<<(bits-1)) - 1)) + 1);
|
||||
else
|
||||
return val;
|
||||
}
|
||||
|
||||
/* ipmi_sdr_get_unit_string - return units for base/modifier
|
||||
*
|
||||
* @type: unit type
|
||||
|
Loading…
x
Reference in New Issue
Block a user