Skip to content

Commit

Permalink
restore base dec() (oops)
Browse files Browse the repository at this point in the history
  • Loading branch information
markusicu committed Jan 7, 2025
1 parent 84dc5f4 commit 8bea75e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions icu4c/source/common/unicode/utf16cppiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ class U16IteratorBase {
// @internal
bool operator!=(const U16IteratorBase &other) const { return !operator==(other); }

// @internal
void dec() {
// TODO: assert current != limit -- more precisely: start <= current < limit
// Very similar to U16_BACK_1().
if (U16_IS_TRAIL(*(--current)) && current != start && U16_IS_LEAD(*(current - 1))) {
--current;
}
}

// @internal
CodeUnits<Unit16, CP32> readAndInc(const Unit16 *&p) const {
// TODO: assert p != limit -- more precisely: start <= p < limit
Expand Down Expand Up @@ -410,6 +419,14 @@ class U16UnsafeIteratorBase {
// @internal
bool operator!=(const U16UnsafeIteratorBase &other) const { return !operator==(other); }

// @internal
void dec() {
// Very similar to U16_BACK_1_UNSAFE().
if (U16_IS_TRAIL(*(--current))) {
--current;
}
}

// @internal
UnsafeCodeUnits<Unit16, CP32> readAndInc(const Unit16 *&p) const {
// Very similar to U16_NEXT_UNSAFE().
Expand Down

0 comments on commit 8bea75e

Please sign in to comment.