circular_queue.hh (13796:ca1eed45ebe5) circular_queue.hh (13797:1969bb477391)
1/*
2 * Copyright (c) 2017-2018 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 309 unchanged lines hidden (view full) ---

318 return *this;
319 }
320
321 iterator& operator-=(const difference_type& t)
322 {
323 assert(_cq);
324
325 /* C does not do euclidean division, so we have to adjust */
1/*
2 * Copyright (c) 2017-2018 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 309 unchanged lines hidden (view full) ---

318 return *this;
319 }
320
321 iterator& operator-=(const difference_type& t)
322 {
323 assert(_cq);
324
325 /* C does not do euclidean division, so we have to adjust */
326 if (t >= 0)
326 if (t >= 0) {
327 _round += (-t + _idx) / _cq->capacity();
327 _round += (-t + _idx) / _cq->capacity();
328 else
329 _round += (-t + _idx - _cq->capacity() + 1) / _cq->capacity();
330
331 _idx = _cq->moduloSub(_idx, t);
328 _idx = _cq->moduloSub(_idx, t);
329 } else {
330 *this += -t;
331 }
332 return *this;
333 }
334
335 /** Addition operator. */
336 iterator operator+(const difference_type& t)
337 {
338 iterator ret(*this);
339 return ret += t;

--- 313 unchanged lines hidden ---
332 return *this;
333 }
334
335 /** Addition operator. */
336 iterator operator+(const difference_type& t)
337 {
338 iterator ret(*this);
339 return ret += t;

--- 313 unchanged lines hidden ---