ASCII fastpath for towupper and towlower.

This change elides unnecessary calls to __find_icu_symbol
for ASCII chars and improves PUBG mobile game loading time by 7% on
hikey620(Cortex-A53):

name                old time/op  new time/op  delta
PUBG_0.13.0_Launch   41.5s ± 2%   37.7s ± 3%  -9.24%  (p=0.008 n=5+5)

Below are the bionic benchmark results on a Pixel 2 XL for 64-bit,
showing a large speedup for ASCII and only a small slowdown for non-ASCII.

Before:

  BM_wctype_towlower_ascii_n         10.5 ns         10.4 ns     61973065
  BM_wctype_towlower_ascii_y         10.2 ns         10.2 ns     70158659
  BM_wctype_towlower_unicode_n       10.3 ns         10.3 ns     67719478
  BM_wctype_towlower_unicode_y       10.6 ns         10.5 ns     67841545
  BM_wctype_towupper_ascii_n         10.8 ns         10.8 ns     63456778
  BM_wctype_towupper_ascii_y         10.9 ns         10.9 ns     65116910
  BM_wctype_towupper_unicode_n       10.7 ns         10.7 ns     67463276
  BM_wctype_towupper_unicode_y       10.4 ns         10.4 ns     66467890

After:

  BM_wctype_towlower_ascii_n         3.35 ns         3.34 ns    205567652
  BM_wctype_towlower_ascii_y         3.30 ns         3.29 ns    214108746
  BM_wctype_towlower_unicode_n       10.9 ns         10.8 ns     65007743
  BM_wctype_towlower_unicode_y       10.6 ns         10.6 ns     63819060
  BM_wctype_towupper_ascii_n         3.53 ns         3.53 ns    195944444
  BM_wctype_towupper_ascii_y         3.48 ns         3.48 ns    199233248
  BM_wctype_towupper_unicode_n       11.1 ns         11.1 ns     62760216
  BM_wctype_towupper_unicode_y       11.0 ns         11.0 ns     61608872

Test: bionic unit tests on device
Test: bionic benchmarks on device
Signed-off-by: Balaram Makam <b.makam@samsung.com>
Change-Id: I77ab7efb66d7bcb35d00467663607535e5c1992f
diff --git a/libc/bionic/wctype.cpp b/libc/bionic/wctype.cpp
index 6e33b6c..061f55a 100644
--- a/libc/bionic/wctype.cpp
+++ b/libc/bionic/wctype.cpp
@@ -117,12 +117,22 @@
 }
 
 wint_t towlower(wint_t wc) {
+  if (wc < 0x80) {
+    if (wc >= 'A' && wc <= 'Z') return wc | 0x20;
+    return wc;
+  }
+
   typedef UChar32 (*FnT)(UChar32);
   static auto u_tolower = reinterpret_cast<FnT>(__find_icu_symbol("u_tolower"));
   return u_tolower ? u_tolower(wc) : tolower(wc);
 }
 
 wint_t towupper(wint_t wc) {
+  if (wc < 0x80) {
+    if (wc >= 'a' && wc <= 'z') return wc & 0xdf;
+    return wc;
+  }
+
   typedef UChar32 (*FnT)(UChar32);
   static auto u_toupper = reinterpret_cast<FnT>(__find_icu_symbol("u_toupper"));
   return u_toupper ? u_toupper(wc) : toupper(wc);