UDI_ATTR32_SET, UDI_ATTR32_GET, UDI_ATTR32_INIT
Instance attribute encoding/decoding utilities
#include <udi.h>#define UDI_ATTR32_SET(aval, v) \ { udi_ubit32_t vtmp = (v); \ (aval)[0] = (vtmp) & 0xff; \ (aval)[1] = ((vtmp) >> 8) & 0xff; \ (aval)[2] = ((vtmp) >> 16) & 0xff; \ (aval)[3] = ((vtmp) >> 24) & 0xff; } #define UDI_ATTR32_GET(aval) \ ((aval)[0] + ((aval)[1] << 8) + \ ((aval)[2] << 16) + ((aval)[3] << 24)) #define UDI_ATTR32_INIT(v) \ { (v) & 0xff, ((v) >> 8) & 0xff, \ ((v) >> 16) & 0xff, ((v) >> 24) & 0xff }ARGUMENTS aval is the attr_value array which holds an encoded UDI_ATTR_UBIT32 instance attribute value.
v is the udi_ubit32_t value for the instance attribute.
DESCRIPTION These utility macros are used to access values in the attr_value member of a udi_instance_attr_list_t structure when attr_type is UDI_ATTR_UBIT32. In this case, the 32-bit unsigned integer value is encoded as a little-endian value in the first four bytes of attr_value.
UDI_ATTR32_SET assigns a udi_ubit32_t value to an attr_value array, using the above encoding.
UDI_ATTR32_GET extracts a udi_ubit32_t value from an attr_value array, using the above encoding.
UDI_ATTR32_INIT initializes an attr_value from a udi_ubit32_t constant value as a compile-time initializer.
REFERENCES udi_mem_alloc, udi_instance_attr_list_t, udi_instance_attr_type_t