* Converts a digit/integer into a basic code point. * @see `basicToDigit()` * @private * @param {Number} digit The numeric value of a basic code point. * @returns {Number} The basic code point whose value (when used for * representing integers) is `digit`, which needs to be in the range
(digit, flag)
| 1621 | * if `flag` is non-zero and `digit` has no uppercase form. |
| 1622 | */ |
| 1623 | function digitToBasic(digit, flag) { |
| 1624 | // 0..25 map to ASCII a..z or A..Z |
| 1625 | // 26..35 map to ASCII 0..9 |
| 1626 | return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); |
| 1627 | } |
| 1628 | |
| 1629 | /** |
| 1630 | * Bias adaptation function as per section 3.4 of RFC 3492. |