On Mon, Feb 26, 2024 at 04:51:08PM +0100, Michael Matz wrote: > On Mon, 26 Feb 2024, Jakub Jelinek wrote: > > > > Will update the patch, I think any improvement should be done > > > to get_range_pos_neg (it's a bit odd in behavior for unsigned > > > but I have only signed things incoming). > > > > For unsigned if it always returned 1, it would be quite useless, there would > > be no point for the caller to call it in that case. > > Which seems to make sense for a function called ...pos_neg on unsigned > types. I would expect calling it to be useless and always return "yep, > non-negative, why did you ask?".
The callers heavily rely on it doing for unsigned types what it does now and it matches what the function comment says. If you have a suggestion for a different name that wouldn't be much longer than the current one, it can be renamed. get_msb_range? Except it doesn't return a range for the most significant bit, but a bitmask which values are possible. Jakub