lkml.org 
[lkml]   [2021]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Input: spaceball - fix parsing of movement data packets
On Mon, Dec 20, 2021 at 12:59:21AM -0800, Dmitry Torokhov wrote:
> Could we write
>
> for (i == 0; i < ARRAY_SIZE(spaceball_axes); i++)
> input_report_abs(dev, spaceball_axes[i],
> (__s16)(get_unaligned_be16(&data[i * 2]);
>
> instead?
>
It's not as readable, but sure, I could do that.

> for (i == 0; i < ARRAY_SIZE(spaceball_axes); i++)
^^
Pretty sure you didn't mean that :-).

> input_report_abs(dev, spaceball_axes[i],
> (__s16)(get_unaligned_be16(&data[i * 2]);
^^^^^^^
I'm new here, but it seems odd that an array index (shift plus add
to the base pointer) is preferred over a direct pointer reference.

> (__s16)(get_unaligned_be16(&data[i * 2]);
^^^^^^^^^^^^^^^^^^
Ooo! Didn't know about this; thank you!

Schwab

\
 
 \ /
  Last update: 2021-12-21 11:33    [W:0.642 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site