|
@@ -0,0 +1,48 @@
|
|
|
+# HG changeset patch
|
|
|
+# User Robert Helmer <rhelmer@mozilla.com>
|
|
|
+# Date 1529540477 25200
|
|
|
+# Node ID 9b41ca132dbc6462cc5afbd52b06a9a9b5b00c12
|
|
|
+# Parent 1e6b919293b6075e306b013f76230ecef262d59d
|
|
|
+Bug 1421501 - WebIDL and DOM for PrioEncoder r=edgar,hsivonen
|
|
|
+
|
|
|
+mfbt only part for later SpiderMonkey changes.
|
|
|
+
|
|
|
+MozReview-Commit-ID: L8htRm3J1mZ
|
|
|
+
|
|
|
+diff --git a/mfbt/TextUtils.h b/mfbt/TextUtils.h
|
|
|
+--- a/mfbt/TextUtils.h
|
|
|
++++ b/mfbt/TextUtils.h
|
|
|
+@@ -116,16 +116,32 @@ constexpr bool
|
|
|
+ IsAsciiDigit(Char aChar)
|
|
|
+ {
|
|
|
+ using UnsignedChar = typename detail::MakeUnsignedChar<Char>::Type;
|
|
|
+ auto uc = static_cast<UnsignedChar>(aChar);
|
|
|
+ return '0' <= uc && uc <= '9';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
++ * Returns true iff |aChar| matches [0-9a-fA-F].
|
|
|
++ *
|
|
|
++ * This function is basically isxdigit, but guaranteed to be only for ASCII.
|
|
|
++ */
|
|
|
++template<typename Char>
|
|
|
++constexpr bool
|
|
|
++IsAsciiHexDigit(Char aChar)
|
|
|
++{
|
|
|
++ using UnsignedChar = typename detail::MakeUnsignedChar<Char>::Type;
|
|
|
++ auto uc = static_cast<UnsignedChar>(aChar);
|
|
|
++ return ('0' <= uc && uc <= '9') ||
|
|
|
++ ('a' <= uc && uc <= 'f') ||
|
|
|
++ ('A' <= uc && uc <= 'F');
|
|
|
++}
|
|
|
++
|
|
|
++/**
|
|
|
+ * Returns true iff |aChar| matches [a-zA-Z0-9].
|
|
|
+ *
|
|
|
+ * This function is basically what you thought isalnum was, except its behavior
|
|
|
+ * doesn't depend on the user's current locale.
|
|
|
+ */
|
|
|
+ template<typename Char>
|
|
|
+ constexpr bool
|
|
|
+ IsAsciiAlphanumeric(Char aChar)
|
|
|
+
|