Chromium Code Reviews

Unified Diff: source/common/uchar.c

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « source/common/ucat.c ('k') | source/common/uchar_props_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/uchar.c
diff --git a/source/common/uchar.c b/source/common/uchar.c
index 57e00afc10f8b124052cbfdbaf65ea800de39f6a..496df86f4ce1bf37f55a7df0465f6feded7b8522 100644
--- a/source/common/uchar.c
+++ b/source/common/uchar.c
@@ -1,6 +1,8 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
-* Copyright (C) 1996-2014, International Business Machines
+* Copyright (C) 1996-2016, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -434,7 +436,7 @@ u_getNumericValue(UChar32 c) {
}
return numValue;
- } else if(ntv<UPROPS_NTV_RESERVED_START) {
+ } else if(ntv<UPROPS_NTV_FRACTION20_START) {
/* sexagesimal (base 60) integer */
int32_t numValue=(ntv>>2)-0xbf;
int32_t exp=(ntv&3)+1;
@@ -458,6 +460,12 @@ u_getNumericValue(UChar32 c) {
}
return numValue;
+ } else if(ntv<UPROPS_NTV_RESERVED_START) {
+ // fraction-20 e.g. 3/80
+ int32_t frac20=ntv-UPROPS_NTV_FRACTION20_START; // 0..0x17
+ int32_t numerator=2*(frac20&3)+1;
+ int32_t denominator=20<<(frac20>>2);
+ return (double)numerator/denominator;
} else {
/* reserved */
return U_NO_NUMERIC_VALUE;
« no previous file with comments | « source/common/ucat.c ('k') | source/common/uchar_props_data.h » ('j') | no next file with comments »

Powered by Google App Engine