I have some c macros in the form of
#define VARATT_IS_4B(PTR) \
((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x00)
and want to convert it to Go lang. I am doing something like
func varAttIs1B(ptr uintptr) bool {
return (*varAttrib1b(ptr).vaHeader & 0x01) == 0x01
}
but yeah, it is not working and I am getting compiler error "cannot convert ptr (type int) to type varAttrib1b".
varAttrib1b is a struct with two fields and ptr is a uintptr(could be some other type also).
type varAttrib1b struct {
vaHeader uint8
vaData []string
}
How can I do this?