Hi,

It might be simpler to use:

   k = Math.max(n, 0);        // non-negative or zero
k = Math.min(k, count - pos); // the smaller of the request and what's available
(or combine in a single expression)

Roger


On 8/10/2016 3:40 PM, Aleksey Shipilev wrote:
On 08/10/2016 08:55 PM, Ivan Gerasimov wrote:
http://cr.openjdk.java.net/~igerasim/8163518/01/webrev/

Would you please help review it once again?
I wonder, shouldn't it be (n <= k) here:

  164             long k = count - pos;
  165             if (n < k) {
  166                 k = (n <= 0) ? 0 : n;
  167             }
  168             pos += k;
  169             return k;

"k" is the max number of chars to skip. It should be possible to skip
all remaining chars when (n == k), right?

Thanks,
-Aleksey




Reply via email to