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