<br>On Monday, June 2, 2014, Renato Golin <<a href="mailto:renato.golin@linaro.org">renato.golin@linaro.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 2 June 2014 02:17, Saleem Abdulrasool <<a href="javascript:;" onclick="_e(event, 'cvml', 'compnerd@compnerd.org')">compnerd@compnerd.org</a>> wrote:<br>
> +  bool H() const {<br>
> +    assert((Flag() == RuntimeFunctionFlag::RFF_Packed ||<br>
> +            Flag() == RuntimeFunctionFlag::RFF_PackedFragment) &&<br>
> +           "packed form required for this operation");<br>
> +    return ((UnwindData & 0x00008000) >> 15);<br>
> +  }<br>
> +  uint8_t Reg() const {<br>
> +    assert((Flag() == RuntimeFunctionFlag::RFF_Packed ||<br>
> +            Flag() == RuntimeFunctionFlag::RFF_PackedFragment) &&<br>
> +           "packed form required for this operation");<br>
> +    return ((UnwindData & 0x00070000) >> 16);<br>
> +  }<br>
> +  bool R() const {<br>
> +    assert((Flag() == RuntimeFunctionFlag::RFF_Packed ||<br>
> +            Flag() == RuntimeFunctionFlag::RFF_PackedFragment) &&<br>
> +           "packed form required for this operation");<br>
> +    return ((UnwindData & 0x00080000) >> 19);<br>
> +  }<br>
<br>
Hi Saleem,<br>
<br>
These (and the ones below), look like they could be a single function<br>
with a bit of magic...</blockquote><div><br></div><div>Yes, they could.  I considered it for a while and decided against it.  Ideally, these structures would use bitfields.  However, that is not possible due to portability of these tools (WoA itself is little endian only).  These functions are meant to be accessors for those fields.<span></span></div>
<div><br></div><div>By having the two separate, these functions you have direct access to individual fields as well as the ability to easily work with them.</div><div><br></div><div>Consider the case of readobj which is going to be using these structures.  Rather than obscuring the data, forcing the reconstruction of the information, why not simply have an additional set of functions?</div>
<div><br></div><div>Perhaps I should add a comment explaining that the structure definition is based solely on what Microsoft defines them to be?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

cheers,<br>
--renato<br>
</blockquote><br><br>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org<br>