[libc] Templatize strtointeger implementation. (#165884)

* Removes the copy-pasta implementation of wcstointeger,
  and migrate the wcsto* family of functions to use a template
  version of strtointeger.
* Fixes the out-of-bound read in the original implementation(s)
  when the entire input string consists of whitespaces
  (then the sign check can access OOB memory)

The code is currently slightly peppered with "if constexpr" statements
to distinguish between char and wchar_t. We can probably
simplify it in subsequent changes by:
* using overrides, so that internal::isalnum() is overriden for
  both char and wchar_t (since C++ luckily allows us to reuse names).
* this wouldn't help for direct comparison with literals -
for this as a somewhat ugly workaround like is_char_literal(c, '0',
L'0')

GitOrigin-RevId: 315dfe5865962d8a3d60e21d1fffce5214fe54ef
11 files changed