make this function a macro

This commit is contained in:
Duncan Laurie 2005-07-14 00:21:26 +00:00
parent 54d6016a31
commit b3472220af
2 changed files with 2 additions and 19 deletions

View File

@ -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)

View File

@ -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