|
35 | 35 |
|
36 | 36 | import jdk.internal.misc.Unsafe; |
37 | 37 | import jdk.internal.util.ArraysSupport; |
38 | | -import jdk.internal.util.DecimalDigits; |
39 | 38 | import jdk.internal.vm.annotation.ForceInline; |
40 | 39 | import jdk.internal.vm.annotation.IntrinsicCandidate; |
41 | 40 |
|
@@ -1513,20 +1512,6 @@ public static int codePointCountSB(byte[] val, int beginIndex, int endIndex) { |
1513 | 1512 | return codePointCount(val, beginIndex, endIndex, true /* checked */); |
1514 | 1513 | } |
1515 | 1514 |
|
1516 | | - public static int getChars(int i, int begin, int end, byte[] value) { |
1517 | | - checkBoundsBeginEnd(begin, end, value); |
1518 | | - int pos = getChars(i, end, value); |
1519 | | - assert begin == pos; |
1520 | | - return pos; |
1521 | | - } |
1522 | | - |
1523 | | - public static int getChars(long l, int begin, int end, byte[] value) { |
1524 | | - checkBoundsBeginEnd(begin, end, value); |
1525 | | - int pos = getChars(l, end, value); |
1526 | | - assert begin == pos; |
1527 | | - return pos; |
1528 | | - } |
1529 | | - |
1530 | 1515 | public static boolean contentEquals(byte[] v1, byte[] v2, int len) { |
1531 | 1516 | checkBoundsOffCount(0, len, v2); |
1532 | 1517 | for (int i = 0; i < len; i++) { |
@@ -1662,109 +1647,6 @@ public static int lastIndexOfLatin1(byte[] src, int srcCount, |
1662 | 1647 |
|
1663 | 1648 | static final int MAX_LENGTH = Integer.MAX_VALUE >> 1; |
1664 | 1649 |
|
1665 | | - // Used by trusted callers. Assumes all necessary bounds checks have |
1666 | | - // been done by the caller. |
1667 | | - |
1668 | | - /** |
1669 | | - * This is a variant of {@link StringLatin1#getChars(int, int, byte[])}, but for |
1670 | | - * UTF-16 coder. |
1671 | | - * |
1672 | | - * @param i value to convert |
1673 | | - * @param index next index, after the least significant digit |
1674 | | - * @param buf target buffer, UTF16-coded. |
1675 | | - * @return index of the most significant digit or minus sign, if present |
1676 | | - */ |
1677 | | - static int getChars(int i, int index, byte[] buf) { |
1678 | | - // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. |
1679 | | - int q, r; |
1680 | | - int charPos = index; |
1681 | | - |
1682 | | - boolean negative = (i < 0); |
1683 | | - if (!negative) { |
1684 | | - i = -i; |
1685 | | - } |
1686 | | - |
1687 | | - // Get 2 digits/iteration using ints |
1688 | | - while (i <= -100) { |
1689 | | - q = i / 100; |
1690 | | - r = (q * 100) - i; |
1691 | | - i = q; |
1692 | | - charPos -= 2; |
1693 | | - putPair(buf, charPos, r); |
1694 | | - } |
1695 | | - |
1696 | | - // We know there are at most two digits left at this point. |
1697 | | - if (i < -9) { |
1698 | | - charPos -= 2; |
1699 | | - putPair(buf, charPos, -i); |
1700 | | - } else { |
1701 | | - putChar(buf, --charPos, '0' - i); |
1702 | | - } |
1703 | | - |
1704 | | - if (negative) { |
1705 | | - putChar(buf, --charPos, '-'); |
1706 | | - } |
1707 | | - return charPos; |
1708 | | - } |
1709 | | - |
1710 | | - /** |
1711 | | - * This is a variant of {@link StringLatin1#getChars(long, int, byte[])}, but for |
1712 | | - * UTF-16 coder. |
1713 | | - * |
1714 | | - * @param i value to convert |
1715 | | - * @param index next index, after the least significant digit |
1716 | | - * @param buf target buffer, UTF16-coded. |
1717 | | - * @return index of the most significant digit or minus sign, if present |
1718 | | - */ |
1719 | | - static int getChars(long i, int index, byte[] buf) { |
1720 | | - // Used by trusted callers. Assumes all necessary bounds checks have been done by the caller. |
1721 | | - long q; |
1722 | | - int charPos = index; |
1723 | | - |
1724 | | - boolean negative = (i < 0); |
1725 | | - if (!negative) { |
1726 | | - i = -i; |
1727 | | - } |
1728 | | - |
1729 | | - // Get 2 digits/iteration using longs until quotient fits into an int |
1730 | | - while (i <= Integer.MIN_VALUE) { |
1731 | | - q = i / 100; |
1732 | | - charPos -= 2; |
1733 | | - putPair(buf, charPos, (int)((q * 100) - i)); |
1734 | | - i = q; |
1735 | | - } |
1736 | | - |
1737 | | - // Get 2 digits/iteration using ints |
1738 | | - int q2; |
1739 | | - int i2 = (int)i; |
1740 | | - while (i2 <= -100) { |
1741 | | - q2 = i2 / 100; |
1742 | | - charPos -= 2; |
1743 | | - putPair(buf, charPos, (q2 * 100) - i2); |
1744 | | - i2 = q2; |
1745 | | - } |
1746 | | - |
1747 | | - // We know there are at most two digits left at this point. |
1748 | | - if (i2 < -9) { |
1749 | | - charPos -= 2; |
1750 | | - putPair(buf, charPos, -i2); |
1751 | | - } else { |
1752 | | - putChar(buf, --charPos, '0' - i2); |
1753 | | - } |
1754 | | - |
1755 | | - if (negative) { |
1756 | | - putChar(buf, --charPos, '-'); |
1757 | | - } |
1758 | | - return charPos; |
1759 | | - } |
1760 | | - |
1761 | | - private static void putPair(byte[] buf, int charPos, int v) { |
1762 | | - int packed = (int) DecimalDigits.digitPair(v); |
1763 | | - putChar(buf, charPos, packed & 0xFF); |
1764 | | - putChar(buf, charPos + 1, packed >> 8); |
1765 | | - } |
1766 | | - // End of trusted methods. |
1767 | | - |
1768 | 1650 | public static void checkIndex(int off, byte[] val) { |
1769 | 1651 | String.checkIndex(off, length(val)); |
1770 | 1652 | } |
|
0 commit comments