bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] bitwise functions with negative values


From: Manuel Collado
Subject: Re: [bug-gawk] bitwise functions with negative values
Date: Wed, 05 Oct 2016 15:45:59 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0

El 05/10/2016 2:16, Andrew J. Schorr escribió:
[...]
Also, I think it's pretty weird that bits2str in the doc uses
zero-padding on the left. That gives strange results for negative values.

It's not clear how to address these various issues. One idea is to stop
supporting negative values with these bitwise functions. And I'm not sure
whether compl makes any sense at all. Thoughts?

Perhaps the simplest approach is to consider bitwise functions as operations on bit strings of fixed length, regardless of their possible numeric interpretation.

For right shifts (similar for left shifts), there are usually three variants:

- Logical, padding with zeros.
- "Arithmetic", propagating the leftmost bit.
- Circular, recycling the rightmost bit.

IMHO, all these distinct variants could/should be provided.

Just my two cents. Regards.
--
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado




reply via email to

[Prev in Thread] Current Thread [Next in Thread]