[Mesa-dev] [PATCH 3/5] aubinator: Simplify print_dword_val() method
Kenneth Graunke
kenneth at whitecape.org
Fri Sep 9 01:55:39 UTC 2016
On Thursday, September 8, 2016 4:15:20 PM PDT Sirisha Gandikota wrote:
> From: Sirisha Gandikota <Sirisha.Gandikota at intel.com>
>
> Remove the float/dword union and use the iter->p[f->start / 32]
> directly as printf formatter %08x expects uint32_t (Ken)
>
> Signed-off-by: Sirisha Gandikota <Sirisha.Gandikota at intel.com>
> ---
> src/intel/tools/aubinator.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
> index 811f707..d147225 100644
> --- a/src/intel/tools/aubinator.c
> +++ b/src/intel/tools/aubinator.c
> @@ -92,17 +92,13 @@ print_dword_val(struct gen_field_iterator *iter, uint64_t offset,
> int *dword_num)
> {
> struct gen_field *f;
> - union {
> - uint32_t dw;
> - float f;
> - } v;
>
> f = iter->group->fields[iter->i - 1];
> - v.dw = iter->p[f->start / 32];
>
> if (*dword_num != (f->start / 32)) {
> printf("0x%08lx: 0x%08x : Dword %d\n",
> - offset + 4 * (f->start / 32), v.dw, f->start / 32);
> + offset + 4 * (f->start / 32), iter->p[f->start / 32], f->start /
> +32);
> *dword_num = (f->start / 32);
> }
> }
>
Perhaps do:
const int dword = f->start / 32;
and then use that everywhere instead of repeating f->start / 32 in four
places? Seems a little tidier.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160908/8ae0cd7c/attachment.sig>
More information about the mesa-dev
mailing list