[sane-devel] More Proposed Upgrades
paddy-hack at member.fsf.org
Tue Sep 29 09:41:51 UTC 2015
Yury Tarasievich writes:
> On 09/29/2015 04:25 AM, m. allan noah wrote:
>> I just pushed all of these. I did re-write the microtek2 patch to use
>> the logic I pointed out in a prior mail.
> /meaning sequenced `% 2` changed to sequenced '!'/
> Isn't this fancy-coding now, though?
> I didn't look in the backend and may have
> completely missed the point, however, applying
> %2 to integers would (in gcc) change odd values
> to 1s, even values to 0s, with subsequent
> applications of the routine having no further
> Your change would interchange not-zeroes and
> zeroes every time.
I *was* going to agree with you wholeheartedly until I looked the '!'
operator up at cppreference.com.
That, combined with
ms->buf.current_src = 0; /* index to current buffer */
uint8_t *src_buffer; /* two buffers because of CCD gap */
and the use of ms->buf.current_src in backend/microtek2.c, made me
change my mind.
I agree with you that rewriting to use 0s and 1s is a clearer way of
preserving the intended meaning of the original expression, the spec
apparently says that !E evaluates to 1 for any scalar E that compares
equal to zero. In that case, both ways are identical.
Hope this helps,
Olaf Meeuwissen, LPIC-2 FSF Associate Member since 2004-01-27
Support Free Software Support the Free Software Foundation
More information about the sane-devel