MCPcopy Create free account
hub / github.com/mozilla/rhino / xDigitToInt

Method xDigitToInt

rhino/src/main/java/org/mozilla/javascript/Kit.java:72–95  ·  view source on GitHub ↗

If character c is a hexadecimal digit, return accumulator 16 plus corresponding number. Otherwise return -1.

(int c, int accumulator)

Source from the content-addressed store, hash-verified

70 * corresponding number. Otherwise return -1.
71 */
72 public static int xDigitToInt(int c, int accumulator) {
73 check:
74 {
75 // Use 0..9 < A..Z < a..z
76 if (c <= '9') {
77 c -= '0';
78 if (0 <= c) {
79 break check;
80 }
81 } else if (c <= 'F') {
82 if ('A' <= c) {
83 c -= ('A' - 10);
84 break check;
85 }
86 } else if (c <= 'f') {
87 if ('a' <= c) {
88 c -= ('a' - 10);
89 break check;
90 }
91 }
92 return -1;
93 }
94 return (accumulator << 4) | c;
95 }
96
97 /**
98 * Add <i>listener</i> to <i>bag</i> of listeners. The function does not modify <i>bag</i> and

Callers 5

getTokenMethod · 0.95
readTemplateLiteralMethod · 0.95
js_unescapeMethod · 0.95
readNHexDigitsMethod · 0.95
parseUnicodeCodePointMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected