Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: source/i18n/digitinterval.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/i18n/digitinterval.h ('k') | source/i18n/digitlst.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2015, International Business Machines
3 * Corporation and others. All Rights Reserved.
4 *
5 * file name: digitinterval.cpp
6 */
7
8 #include "unicode/utypes.h"
9
10 #include "digitinterval.h"
11
12 U_NAMESPACE_BEGIN
13
14 void DigitInterval::expandToContain(const DigitInterval &rhs) {
15 if (fSmallestInclusive > rhs.fSmallestInclusive) {
16 fSmallestInclusive = rhs.fSmallestInclusive;
17 }
18 if (fLargestExclusive < rhs.fLargestExclusive) {
19 fLargestExclusive = rhs.fLargestExclusive;
20 }
21 }
22
23 void DigitInterval::shrinkToFitWithin(const DigitInterval &rhs) {
24 if (fSmallestInclusive < rhs.fSmallestInclusive) {
25 fSmallestInclusive = rhs.fSmallestInclusive;
26 }
27 if (fLargestExclusive > rhs.fLargestExclusive) {
28 fLargestExclusive = rhs.fLargestExclusive;
29 }
30 }
31
32 void DigitInterval::setIntDigitCount(int32_t count) {
33 fLargestExclusive = count < 0 ? INT32_MAX : count;
34 }
35
36 void DigitInterval::setFracDigitCount(int32_t count) {
37 fSmallestInclusive = count < 0 ? INT32_MIN : -count;
38 }
39
40 void DigitInterval::expandToContainDigit(int32_t digitExponent) {
41 if (fLargestExclusive <= digitExponent) {
42 fLargestExclusive = digitExponent + 1;
43 } else if (fSmallestInclusive > digitExponent) {
44 fSmallestInclusive = digitExponent;
45 }
46 }
47
48 UBool DigitInterval::contains(int32_t x) const {
49 return (x < fLargestExclusive && x >= fSmallestInclusive);
50 }
51
52
53 U_NAMESPACE_END
54
OLDNEW
« no previous file with comments | « source/i18n/digitinterval.h ('k') | source/i18n/digitlst.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698