| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | <link rel="icon" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNTMgMTQwIj48ZyBmaWxsPSIjRjdBNDFEIj48Zz48cG9seWdvbiBwb2ludHM9IjQ2LDIyIDI4LDQ0IDE5LDMwIi8+PHBvbHlnb24gcG9pbnRzPSI0NiwyMiAzMywzMyAyOCw0NCAyMiw0NCAyMiw5NSAzMSw5NSAyMCwxMDAgMTIsMTE3IDAsMTE3IDAsMjIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMzEsOTUgMTIsMTE3IDQsMTA2Ii8+PC9nPjxnPjxwb2x5Z29uIHBvaW50cz0iNTYsMjIgNjIsMzYgMzcsNDQiLz48cG9seWdvbiBwb2ludHM9IjU2LDIyIDExMSwyMiAxMTEsNDQgMzcsNDQgNTYsMzIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTE2LDk1IDk3LDExNyA5MCwxMDQiLz48cG9seWdvbiBwb2ludHM9IjExNiw5NSAxMDAsMTA0IDk3LDExNyA0MiwxMTcgNDIsOTUiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTUwLDAgNTIsMTE3IDMsMTQwIDEwMSwyMiIvPjwvZz48Zz48cG9seWdvbiBwb2ludHM9IjE0MSwyMiAxNDAsNDAgMTIyLDQ1Ii8+PHBvbHlnb24gcG9pbnRzPSIxNTMsMjIgMTUzLDExNyAxMDYsMTE3IDEyMCwxMDUgMTI1LDk1IDEzMSw5NSAxMzEsNDUgMTIyLDQ1IDEzMiwzNiAxNDEsMjIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTI1LDk1IDEzMCwxMTAgMTA2LDExNyIvPjwvZz48L2c+PC9zdmc+"> |
| 9 | 9 | <style> |
| 10 | 10 | :root{ |
| 11 | | --nav-width: 24em; |
| 11 | --nav-width: 26em; |
| 12 | 12 | --nav-margin-l: 1em; |
| 13 | 13 | } |
| 14 | 14 | body{ |
| ... | ... | @@ -27,6 +27,25 @@ |
| 27 | 27 | #navigation { |
| 28 | 28 | padding: 0 1em; |
| 29 | 29 | } |
| 30 | table ul { |
| 31 | list-style-type: none; |
| 32 | padding: 0em; |
| 33 | } |
| 34 | table li { |
| 35 | padding-bottom: 1em; |
| 36 | line-height:1.2em; |
| 37 | } |
| 38 | table, th, td { |
| 39 | border-collapse: collapse; |
| 40 | border: 1px solid grey; |
| 41 | } |
| 42 | th, td { |
| 43 | padding: 0.5em; |
| 44 | } |
| 45 | th[scope=row] { |
| 46 | text-align: left; |
| 47 | font-weight: normal; |
| 48 | } |
| 30 | 49 | |
| 31 | 50 | @media screen and (min-width: 1025px) { |
| 32 | 51 | header { |
| ... | ... | @@ -61,17 +80,6 @@ |
| 61 | 80 | dt { |
| 62 | 81 | font-weight: bold; |
| 63 | 82 | } |
| 64 | | table, th, td { |
| 65 | | border-collapse: collapse; |
| 66 | | border: 1px solid grey; |
| 67 | | } |
| 68 | | th, td { |
| 69 | | padding: 0.1em; |
| 70 | | } |
| 71 | | th[scope=row] { |
| 72 | | text-align: left; |
| 73 | | font-weight: normal; |
| 74 | | } |
| 75 | 83 | .sgr-1m { |
| 76 | 84 | font-weight: bold; |
| 77 | 85 | } |
| ... | ... | @@ -1475,26 +1483,27 @@ pub fn main() void { |
| 1475 | 1483 | {#header_open|Table of Operators#} |
| 1476 | 1484 | <div class="table-wrapper"> |
| 1477 | 1485 | <table> |
| 1478 | | <caption>Table of Operators</caption> |
| 1479 | 1486 | <thead> |
| 1480 | 1487 | <tr> |
| 1488 | <th scope="col">Name</th> |
| 1481 | 1489 | <th scope="col">Syntax</th> |
| 1482 | | <th scope="col">Relevant Types</th> |
| 1483 | | <th scope="col">Description</th> |
| 1490 | <th scope="col">Types</th> |
| 1491 | <th scope="col">Remarks</th> |
| 1484 | 1492 | <th scope="col">Example</th> |
| 1485 | 1493 | </tr> |
| 1486 | 1494 | </thead> |
| 1487 | 1495 | <tbody> |
| 1488 | 1496 | <tr> |
| 1489 | | <th scope="row"><pre>{#syntax#}a + b |
| 1490 | | a += b{#endsyntax#}</pre></th> |
| 1497 | <td>Addition</td> |
| 1498 | <td><pre>{#syntax#}a + b |
| 1499 | a += b{#endsyntax#}</pre></td> |
| 1491 | 1500 | <td> |
| 1492 | 1501 | <ul> |
| 1493 | 1502 | <li>{#link|Integers#}</li> |
| 1494 | 1503 | <li>{#link|Floats#}</li> |
| 1495 | 1504 | </ul> |
| 1496 | 1505 | </td> |
| 1497 | | <td>Addition. |
| 1506 | <td> |
| 1498 | 1507 | <ul> |
| 1499 | 1508 | <li>Can cause {#link|overflow|Default Operations#} for integers.</li> |
| 1500 | 1509 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| ... | ... | @@ -1506,51 +1515,54 @@ a += b{#endsyntax#}</pre></th> |
| 1506 | 1515 | </td> |
| 1507 | 1516 | </tr> |
| 1508 | 1517 | <tr> |
| 1509 | | <th scope="row"><pre>{#syntax#}a +% b |
| 1510 | | a +%= b{#endsyntax#}</pre></th> |
| 1518 | <td>Wrapping Addition</td> |
| 1519 | <td><pre>{#syntax#}a +% b |
| 1520 | a +%= b{#endsyntax#}</pre></td> |
| 1511 | 1521 | <td> |
| 1512 | 1522 | <ul> |
| 1513 | 1523 | <li>{#link|Integers#}</li> |
| 1514 | 1524 | </ul> |
| 1515 | 1525 | </td> |
| 1516 | | <td>Wrapping Addition. |
| 1526 | <td> |
| 1517 | 1527 | <ul> |
| 1518 | | <li>Guaranteed to have twos-complement wrapping behavior.</li> |
| 1528 | <li>Twos-complement wrapping behavior.</li> |
| 1519 | 1529 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| 1520 | 1530 | <li>See also {#link|@addWithOverflow#}.</li> |
| 1521 | 1531 | </ul> |
| 1522 | 1532 | </td> |
| 1523 | 1533 | <td> |
| 1524 | | <pre>{#syntax#}@as(u32, std.math.maxInt(u32)) +% 1 == 0{#endsyntax#}</pre> |
| 1534 | <pre>{#syntax#}@as(u32, 0xffffffff) +% 1 == 0{#endsyntax#}</pre> |
| 1525 | 1535 | </td> |
| 1526 | 1536 | </tr> |
| 1527 | 1537 | <tr> |
| 1528 | | <th scope="row"><pre>{#syntax#}a +| b |
| 1529 | | a +|= b{#endsyntax#}</pre></th> |
| 1538 | <td>Saturating Addition</td> |
| 1539 | <td><pre>{#syntax#}a +| b |
| 1540 | a +|= b{#endsyntax#}</pre></td> |
| 1530 | 1541 | <td> |
| 1531 | 1542 | <ul> |
| 1532 | 1543 | <li>{#link|Integers#}</li> |
| 1533 | 1544 | </ul> |
| 1534 | 1545 | </td> |
| 1535 | | <td>Saturating Addition. |
| 1546 | <td> |
| 1536 | 1547 | <ul> |
| 1537 | 1548 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| 1538 | 1549 | </ul> |
| 1539 | 1550 | </td> |
| 1540 | 1551 | <td> |
| 1541 | | <pre>{#syntax#}@as(u32, std.math.maxInt(u32)) +| 1 == @as(u32, std.math.maxInt(u32)){#endsyntax#}</pre> |
| 1552 | <pre>{#syntax#}@as(u8, 255) +| 1 == @as(u8, 255){#endsyntax#}</pre> |
| 1542 | 1553 | </td> |
| 1543 | 1554 | </tr> |
| 1544 | 1555 | <tr> |
| 1545 | | <th scope="row"><pre>{#syntax#}a - b |
| 1546 | | a -= b{#endsyntax#}</pre></th> |
| 1556 | <td>Subtraction</td> |
| 1557 | <td><pre>{#syntax#}a - b |
| 1558 | a -= b{#endsyntax#}</pre></td> |
| 1547 | 1559 | <td> |
| 1548 | 1560 | <ul> |
| 1549 | 1561 | <li>{#link|Integers#}</li> |
| 1550 | 1562 | <li>{#link|Floats#}</li> |
| 1551 | 1563 | </ul> |
| 1552 | 1564 | </td> |
| 1553 | | <td>Subtraction. |
| 1565 | <td> |
| 1554 | 1566 | <ul> |
| 1555 | 1567 | <li>Can cause {#link|overflow|Default Operations#} for integers.</li> |
| 1556 | 1568 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| ... | ... | @@ -1562,33 +1574,35 @@ a -= b{#endsyntax#}</pre></th> |
| 1562 | 1574 | </td> |
| 1563 | 1575 | </tr> |
| 1564 | 1576 | <tr> |
| 1565 | | <th scope="row"><pre>{#syntax#}a -% b |
| 1566 | | a -%= b{#endsyntax#}</pre></th> |
| 1577 | <td>Wrapping Subtraction</td> |
| 1578 | <td><pre>{#syntax#}a -% b |
| 1579 | a -%= b{#endsyntax#}</pre></td> |
| 1567 | 1580 | <td> |
| 1568 | 1581 | <ul> |
| 1569 | 1582 | <li>{#link|Integers#}</li> |
| 1570 | 1583 | </ul> |
| 1571 | 1584 | </td> |
| 1572 | | <td>Wrapping Subtraction. |
| 1585 | <td> |
| 1573 | 1586 | <ul> |
| 1574 | | <li>Guaranteed to have twos-complement wrapping behavior.</li> |
| 1587 | <li>Twos-complement wrapping behavior.</li> |
| 1575 | 1588 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| 1576 | 1589 | <li>See also {#link|@subWithOverflow#}.</li> |
| 1577 | 1590 | </ul> |
| 1578 | 1591 | </td> |
| 1579 | 1592 | <td> |
| 1580 | | <pre>{#syntax#}@as(u32, 0) -% 1 == std.math.maxInt(u32){#endsyntax#}</pre> |
| 1593 | <pre>{#syntax#}@as(u8, 0) -% 1 == 255{#endsyntax#}</pre> |
| 1581 | 1594 | </td> |
| 1582 | 1595 | </tr> |
| 1583 | 1596 | <tr> |
| 1584 | | <th scope="row"><pre>{#syntax#}a -| b |
| 1585 | | a -|= b{#endsyntax#}</pre></th> |
| 1597 | <td>Saturating Subtraction</td> |
| 1598 | <td><pre>{#syntax#}a -| b |
| 1599 | a -|= b{#endsyntax#}</pre></td> |
| 1586 | 1600 | <td> |
| 1587 | 1601 | <ul> |
| 1588 | 1602 | <li>{#link|Integers#}</li> |
| 1589 | 1603 | </ul> |
| 1590 | 1604 | </td> |
| 1591 | | <td>Saturating Subtraction. |
| 1605 | <td> |
| 1592 | 1606 | <ul> |
| 1593 | 1607 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| 1594 | 1608 | </ul> |
| ... | ... | @@ -1598,7 +1612,8 @@ a -|= b{#endsyntax#}</pre></th> |
| 1598 | 1612 | </td> |
| 1599 | 1613 | </tr> |
| 1600 | 1614 | <tr> |
| 1601 | | <th scope="row"><pre>{#syntax#}-a{#endsyntax#}</pre></th> |
| 1615 | <td>Negation</td> |
| 1616 | <td><pre>{#syntax#}-a{#endsyntax#}</pre></td> |
| 1602 | 1617 | <td> |
| 1603 | 1618 | <ul> |
| 1604 | 1619 | <li>{#link|Integers#}</li> |
| ... | ... | @@ -1606,7 +1621,6 @@ a -|= b{#endsyntax#}</pre></th> |
| 1606 | 1621 | </ul> |
| 1607 | 1622 | </td> |
| 1608 | 1623 | <td> |
| 1609 | | Negation. |
| 1610 | 1624 | <ul> |
| 1611 | 1625 | <li>Can cause {#link|overflow|Default Operations#} for integers.</li> |
| 1612 | 1626 | </ul> |
| ... | ... | @@ -1616,32 +1630,33 @@ a -|= b{#endsyntax#}</pre></th> |
| 1616 | 1630 | </td> |
| 1617 | 1631 | </tr> |
| 1618 | 1632 | <tr> |
| 1619 | | <th scope="row"><pre>{#syntax#}-%a{#endsyntax#}</pre></th> |
| 1633 | <td>Wrapping Negation</td> |
| 1634 | <td><pre>{#syntax#}-%a{#endsyntax#}</pre></td> |
| 1620 | 1635 | <td> |
| 1621 | 1636 | <ul> |
| 1622 | 1637 | <li>{#link|Integers#}</li> |
| 1623 | 1638 | </ul> |
| 1624 | 1639 | </td> |
| 1625 | 1640 | <td> |
| 1626 | | Wrapping Negation. |
| 1627 | 1641 | <ul> |
| 1628 | | <li>Guaranteed to have twos-complement wrapping behavior.</li> |
| 1642 | <li>Twos-complement wrapping behavior.</li> |
| 1629 | 1643 | </ul> |
| 1630 | 1644 | </td> |
| 1631 | 1645 | <td> |
| 1632 | | <pre>{#syntax#}-%@as(i32, std.math.minInt(i32)) == std.math.minInt(i32){#endsyntax#}</pre> |
| 1646 | <pre>{#syntax#}-%@as(i8, -127) == -127{#endsyntax#}</pre> |
| 1633 | 1647 | </td> |
| 1634 | 1648 | </tr> |
| 1635 | 1649 | <tr> |
| 1636 | | <th scope="row"><pre>{#syntax#}a * b |
| 1637 | | a *= b{#endsyntax#}</pre></th> |
| 1650 | <td>Multiplication</td> |
| 1651 | <td><pre>{#syntax#}a * b |
| 1652 | a *= b{#endsyntax#}</pre></td> |
| 1638 | 1653 | <td> |
| 1639 | 1654 | <ul> |
| 1640 | 1655 | <li>{#link|Integers#}</li> |
| 1641 | 1656 | <li>{#link|Floats#}</li> |
| 1642 | 1657 | </ul> |
| 1643 | 1658 | </td> |
| 1644 | | <td>Multiplication. |
| 1659 | <td> |
| 1645 | 1660 | <ul> |
| 1646 | 1661 | <li>Can cause {#link|overflow|Default Operations#} for integers.</li> |
| 1647 | 1662 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| ... | ... | @@ -1653,16 +1668,17 @@ a *= b{#endsyntax#}</pre></th> |
| 1653 | 1668 | </td> |
| 1654 | 1669 | </tr> |
| 1655 | 1670 | <tr> |
| 1656 | | <th scope="row"><pre>{#syntax#}a *% b |
| 1657 | | a *%= b{#endsyntax#}</pre></th> |
| 1671 | <td>Wrapping Multiplication</td> |
| 1672 | <td><pre>{#syntax#}a *% b |
| 1673 | a *%= b{#endsyntax#}</pre></td> |
| 1658 | 1674 | <td> |
| 1659 | 1675 | <ul> |
| 1660 | 1676 | <li>{#link|Integers#}</li> |
| 1661 | 1677 | </ul> |
| 1662 | 1678 | </td> |
| 1663 | | <td>Wrapping Multiplication. |
| 1679 | <td> |
| 1664 | 1680 | <ul> |
| 1665 | | <li>Guaranteed to have twos-complement wrapping behavior.</li> |
| 1681 | <li>Twos-complement wrapping behavior.</li> |
| 1666 | 1682 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| 1667 | 1683 | <li>See also {#link|@mulWithOverflow#}.</li> |
| 1668 | 1684 | </ul> |
| ... | ... | @@ -1672,14 +1688,15 @@ a *%= b{#endsyntax#}</pre></th> |
| 1672 | 1688 | </td> |
| 1673 | 1689 | </tr> |
| 1674 | 1690 | <tr> |
| 1675 | | <th scope="row"><pre>{#syntax#}a *| b |
| 1676 | | a *|= b{#endsyntax#}</pre></th> |
| 1691 | <td>Saturating Multiplication</td> |
| 1692 | <td><pre>{#syntax#}a *| b |
| 1693 | a *|= b{#endsyntax#}</pre></td> |
| 1677 | 1694 | <td> |
| 1678 | 1695 | <ul> |
| 1679 | 1696 | <li>{#link|Integers#}</li> |
| 1680 | 1697 | </ul> |
| 1681 | 1698 | </td> |
| 1682 | | <td>Saturating Multiplication. |
| 1699 | <td> |
| 1683 | 1700 | <ul> |
| 1684 | 1701 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| 1685 | 1702 | </ul> |
| ... | ... | @@ -1689,15 +1706,16 @@ a *|= b{#endsyntax#}</pre></th> |
| 1689 | 1706 | </td> |
| 1690 | 1707 | </tr> |
| 1691 | 1708 | <tr> |
| 1692 | | <th scope="row"><pre>{#syntax#}a / b |
| 1693 | | a /= b{#endsyntax#}</pre></th> |
| 1709 | <td>Division</td> |
| 1710 | <td><pre>{#syntax#}a / b |
| 1711 | a /= b{#endsyntax#}</pre></td> |
| 1694 | 1712 | <td> |
| 1695 | 1713 | <ul> |
| 1696 | 1714 | <li>{#link|Integers#}</li> |
| 1697 | 1715 | <li>{#link|Floats#}</li> |
| 1698 | 1716 | </ul> |
| 1699 | 1717 | </td> |
| 1700 | | <td>Division. |
| 1718 | <td> |
| 1701 | 1719 | <ul> |
| 1702 | 1720 | <li>Can cause {#link|overflow|Default Operations#} for integers.</li> |
| 1703 | 1721 | <li>Can cause {#link|Division by Zero#} for integers.</li> |
| ... | ... | @@ -1715,15 +1733,16 @@ a /= b{#endsyntax#}</pre></th> |
| 1715 | 1733 | </td> |
| 1716 | 1734 | </tr> |
| 1717 | 1735 | <tr> |
| 1718 | | <th scope="row"><pre>{#syntax#}a % b |
| 1719 | | a %= b{#endsyntax#}</pre></th> |
| 1736 | <td>Remainder Division</td> |
| 1737 | <td><pre>{#syntax#}a % b |
| 1738 | a %= b{#endsyntax#}</pre></td> |
| 1720 | 1739 | <td> |
| 1721 | 1740 | <ul> |
| 1722 | 1741 | <li>{#link|Integers#}</li> |
| 1723 | 1742 | <li>{#link|Floats#}</li> |
| 1724 | 1743 | </ul> |
| 1725 | 1744 | </td> |
| 1726 | | <td>Remainder Division. |
| 1745 | <td> |
| 1727 | 1746 | <ul> |
| 1728 | 1747 | <li>Can cause {#link|Division by Zero#} for integers.</li> |
| 1729 | 1748 | <li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li> |
| ... | ... | @@ -1739,33 +1758,39 @@ a %= b{#endsyntax#}</pre></th> |
| 1739 | 1758 | </td> |
| 1740 | 1759 | </tr> |
| 1741 | 1760 | <tr> |
| 1742 | | <th scope="row"><pre>{#syntax#}a << b |
| 1743 | | a <<= b{#endsyntax#}</pre></th> |
| 1761 | <td>Bit Shift Left</td> |
| 1762 | <td><pre>{#syntax#}a << b |
| 1763 | a <<= b{#endsyntax#}</pre></td> |
| 1744 | 1764 | <td> |
| 1745 | 1765 | <ul> |
| 1746 | 1766 | <li>{#link|Integers#}</li> |
| 1747 | 1767 | </ul> |
| 1748 | 1768 | </td> |
| 1749 | | <td>Bit Shift Left. |
| 1769 | <td> |
| 1750 | 1770 | <ul> |
| 1751 | | <li>{#syntax#}b{#endsyntax#} must be {#link|comptime-known|comptime#} or have a type with log2 number of bits as {#syntax#}a{#endsyntax#}.</li> |
| 1771 | <li>Moves all bits to the left, inserting new zeroes at the |
| 1772 | least-significant bit.</li> |
| 1773 | <li>{#syntax#}b{#endsyntax#} must be |
| 1774 | {#link|comptime-known|comptime#} or have a type with log2 number |
| 1775 | of bits as {#syntax#}a{#endsyntax#}.</li> |
| 1752 | 1776 | <li>See also {#link|@shlExact#}.</li> |
| 1753 | 1777 | <li>See also {#link|@shlWithOverflow#}.</li> |
| 1754 | 1778 | </ul> |
| 1755 | 1779 | </td> |
| 1756 | 1780 | <td> |
| 1757 | | <pre>{#syntax#}1 << 8 == 256{#endsyntax#}</pre> |
| 1781 | <pre>{#syntax#}0b1 << 8 == 0b100000000{#endsyntax#}</pre> |
| 1758 | 1782 | </td> |
| 1759 | 1783 | </tr> |
| 1760 | 1784 | <tr> |
| 1761 | | <th scope="row"><pre>{#syntax#}a <<| b |
| 1762 | | a <<|= b{#endsyntax#}</pre></th> |
| 1785 | <td>Saturating Bit Shift Left</td> |
| 1786 | <td><pre>{#syntax#}a <<| b |
| 1787 | a <<|= b{#endsyntax#}</pre></td> |
| 1763 | 1788 | <td> |
| 1764 | 1789 | <ul> |
| 1765 | 1790 | <li>{#link|Integers#}</li> |
| 1766 | 1791 | </ul> |
| 1767 | 1792 | </td> |
| 1768 | | <td>Saturating Bit Shift Left. |
| 1793 | <td> |
| 1769 | 1794 | <ul> |
| 1770 | 1795 | <li>See also {#link|@shlExact#}.</li> |
| 1771 | 1796 | <li>See also {#link|@shlWithOverflow#}.</li> |
| ... | ... | @@ -1776,32 +1801,37 @@ a <<|= b{#endsyntax#}</pre></th> |
| 1776 | 1801 | </td> |
| 1777 | 1802 | </tr> |
| 1778 | 1803 | <tr> |
| 1779 | | <th scope="row"><pre>{#syntax#}a >> b |
| 1780 | | a >>= b{#endsyntax#}</pre></th> |
| 1804 | <td>Bit Shift Right</td> |
| 1805 | <td><pre>{#syntax#}a >> b |
| 1806 | a >>= b{#endsyntax#}</pre></td> |
| 1781 | 1807 | <td> |
| 1782 | 1808 | <ul> |
| 1783 | 1809 | <li>{#link|Integers#}</li> |
| 1784 | 1810 | </ul> |
| 1785 | 1811 | </td> |
| 1786 | | <td>Bit Shift Right. |
| 1812 | <td> |
| 1787 | 1813 | <ul> |
| 1788 | | <li>{#syntax#}b{#endsyntax#} must be {#link|comptime-known|comptime#} or have a type with log2 number of bits as {#syntax#}a{#endsyntax#}.</li> |
| 1814 | <li>Moves all bits to the right, inserting zeroes at the most-significant bit.</li> |
| 1815 | <li>{#syntax#}b{#endsyntax#} must be |
| 1816 | {#link|comptime-known|comptime#} or have a type with log2 number |
| 1817 | of bits as {#syntax#}a{#endsyntax#}.</li> |
| 1789 | 1818 | <li>See also {#link|@shrExact#}.</li> |
| 1790 | 1819 | </ul> |
| 1791 | 1820 | </td> |
| 1792 | 1821 | <td> |
| 1793 | | <pre>{#syntax#}10 >> 1 == 5{#endsyntax#}</pre> |
| 1822 | <pre>{#syntax#}0b1010 >> 1 == 0b101{#endsyntax#}</pre> |
| 1794 | 1823 | </td> |
| 1795 | 1824 | </tr> |
| 1796 | 1825 | <tr> |
| 1797 | | <th scope="row"><pre>{#syntax#}a & b |
| 1798 | | a &= b{#endsyntax#}</pre></th> |
| 1826 | <td>Bitwise And</td> |
| 1827 | <td><pre>{#syntax#}a & b |
| 1828 | a &= b{#endsyntax#}</pre></td> |
| 1799 | 1829 | <td> |
| 1800 | 1830 | <ul> |
| 1801 | 1831 | <li>{#link|Integers#}</li> |
| 1802 | 1832 | </ul> |
| 1803 | 1833 | </td> |
| 1804 | | <td>Bitwise AND. |
| 1834 | <td> |
| 1805 | 1835 | <ul> |
| 1806 | 1836 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| 1807 | 1837 | </ul> |
| ... | ... | @@ -1811,14 +1841,15 @@ a &= b{#endsyntax#}</pre></th> |
| 1811 | 1841 | </td> |
| 1812 | 1842 | </tr> |
| 1813 | 1843 | <tr> |
| 1814 | | <th scope="row"><pre>{#syntax#}a | b |
| 1815 | | a |= b{#endsyntax#}</pre></th> |
| 1844 | <td>Bitwise Or</td> |
| 1845 | <td><pre>{#syntax#}a | b |
| 1846 | a |= b{#endsyntax#}</pre></td> |
| 1816 | 1847 | <td> |
| 1817 | 1848 | <ul> |
| 1818 | 1849 | <li>{#link|Integers#}</li> |
| 1819 | 1850 | </ul> |
| 1820 | 1851 | </td> |
| 1821 | | <td>Bitwise OR. |
| 1852 | <td> |
| 1822 | 1853 | <ul> |
| 1823 | 1854 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| 1824 | 1855 | </ul> |
| ... | ... | @@ -1828,14 +1859,15 @@ a |= b{#endsyntax#}</pre></th> |
| 1828 | 1859 | </td> |
| 1829 | 1860 | </tr> |
| 1830 | 1861 | <tr> |
| 1831 | | <th scope="row"><pre>{#syntax#}a ^ b |
| 1832 | | a ^= b{#endsyntax#}</pre></th> |
| 1862 | <td>Bitwise Xor</td> |
| 1863 | <td><pre>{#syntax#}a ^ b |
| 1864 | a ^= b{#endsyntax#}</pre></td> |
| 1833 | 1865 | <td> |
| 1834 | 1866 | <ul> |
| 1835 | 1867 | <li>{#link|Integers#}</li> |
| 1836 | 1868 | </ul> |
| 1837 | 1869 | </td> |
| 1838 | | <td>Bitwise XOR. |
| 1870 | <td> |
| 1839 | 1871 | <ul> |
| 1840 | 1872 | <li>Invokes {#link|Peer Type Resolution#} for the operands.</li> |
| 1841 | 1873 | </ul> |
| ... | ... | @@ -1845,30 +1877,30 @@ a ^= b{#endsyntax#}</pre></th> |
| 1845 | 1877 | </td> |
| 1846 | 1878 | </tr> |
| 1847 | 1879 | <tr> |
| 1848 | | <th scope="row"><pre>{#syntax#}~a{#endsyntax#}</pre></th> |
| 1880 | <td>Bitwise Not</td> |
| 1881 | <td><pre>{#syntax#}~a{#endsyntax#}</pre></td> |
| 1849 | 1882 | <td> |
| 1850 | 1883 | <ul> |
| 1851 | 1884 | <li>{#link|Integers#}</li> |
| 1852 | 1885 | </ul> |
| 1853 | 1886 | </td> |
| 1854 | | <td> |
| 1855 | | Bitwise NOT. |
| 1856 | | </td> |
| 1887 | <td></td> |
| 1857 | 1888 | <td> |
| 1858 | 1889 | <pre>{#syntax#}~@as(u8, 0b10101111) == 0b01010000{#endsyntax#}</pre> |
| 1859 | 1890 | </td> |
| 1860 | 1891 | </tr> |
| 1861 | 1892 | <tr> |
| 1862 | | <th scope="row"><pre>{#syntax#}a orelse b{#endsyntax#}</pre></th> |
| 1893 | <td>Defaulting Optional Unwrap</td> |
| 1894 | <td><pre>{#syntax#}a orelse b{#endsyntax#}</pre></td> |
| 1863 | 1895 | <td> |
| 1864 | 1896 | <ul> |
| 1865 | 1897 | <li>{#link|Optionals#}</li> |
| 1866 | 1898 | </ul> |
| 1867 | 1899 | </td> |
| 1868 | 1900 | <td>If {#syntax#}a{#endsyntax#} is {#syntax#}null{#endsyntax#}, |
| 1869 | | returns {#syntax#}b{#endsyntax#} ("default value"), |
| 1870 | | otherwise returns the unwrapped value of {#syntax#}a{#endsyntax#}. |
| 1871 | | Note that {#syntax#}b{#endsyntax#} may be a value of type {#link|noreturn#}. |
| 1901 | returns {#syntax#}b{#endsyntax#} ("default value"), |
| 1902 | otherwise returns the unwrapped value of {#syntax#}a{#endsyntax#}. |
| 1903 | Note that {#syntax#}b{#endsyntax#} may be a value of type {#link|noreturn#}. |
| 1872 | 1904 | </td> |
| 1873 | 1905 | <td> |
| 1874 | 1906 | <pre>{#syntax#}const value: ?u32 = null; |
| ... | ... | @@ -1877,7 +1909,8 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 1877 | 1909 | </td> |
| 1878 | 1910 | </tr> |
| 1879 | 1911 | <tr> |
| 1880 | | <th scope="row"><pre>{#syntax#}a.?{#endsyntax#}</pre></th> |
| 1912 | <td>Optional Unwrap</td> |
| 1913 | <td><pre>{#syntax#}a.?{#endsyntax#}</pre></td> |
| 1881 | 1914 | <td> |
| 1882 | 1915 | <ul> |
| 1883 | 1916 | <li>{#link|Optionals#}</li> |
| ... | ... | @@ -1893,18 +1926,19 @@ value.? == 5678{#endsyntax#}</pre> |
| 1893 | 1926 | </td> |
| 1894 | 1927 | </tr> |
| 1895 | 1928 | <tr> |
| 1896 | | <th scope="row"><pre>{#syntax#}a catch b |
| 1897 | | a catch |err| b{#endsyntax#}</pre></th> |
| 1929 | <td>Defaulting Error Unwrap</td> |
| 1930 | <td><pre>{#syntax#}a catch b |
| 1931 | a catch |err| b{#endsyntax#}</pre></td> |
| 1898 | 1932 | <td> |
| 1899 | 1933 | <ul> |
| 1900 | 1934 | <li>{#link|Error Unions|Errors#}</li> |
| 1901 | 1935 | </ul> |
| 1902 | 1936 | </td> |
| 1903 | 1937 | <td>If {#syntax#}a{#endsyntax#} is an {#syntax#}error{#endsyntax#}, |
| 1904 | | returns {#syntax#}b{#endsyntax#} ("default value"), |
| 1905 | | otherwise returns the unwrapped value of {#syntax#}a{#endsyntax#}. |
| 1906 | | Note that {#syntax#}b{#endsyntax#} may be a value of type {#link|noreturn#}. |
| 1907 | | {#syntax#}err{#endsyntax#} is the {#syntax#}error{#endsyntax#} and is in scope of the expression {#syntax#}b{#endsyntax#}. |
| 1938 | returns {#syntax#}b{#endsyntax#} ("default value"), |
| 1939 | otherwise returns the unwrapped value of {#syntax#}a{#endsyntax#}. |
| 1940 | Note that {#syntax#}b{#endsyntax#} may be a value of type {#link|noreturn#}. |
| 1941 | {#syntax#}err{#endsyntax#} is the {#syntax#}error{#endsyntax#} and is in scope of the expression {#syntax#}b{#endsyntax#}. |
| 1908 | 1942 | </td> |
| 1909 | 1943 | <td> |
| 1910 | 1944 | <pre>{#syntax#}const value: anyerror!u32 = error.Broken; |
| ... | ... | @@ -1913,51 +1947,55 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 1913 | 1947 | </td> |
| 1914 | 1948 | </tr> |
| 1915 | 1949 | <tr> |
| 1916 | | <th scope="row"><pre>{#syntax#}a and b{#endsyntax#}</pre></th> |
| 1950 | <td>Logical And</td> |
| 1951 | <td><pre>{#syntax#}a and b{#endsyntax#}</pre></td> |
| 1917 | 1952 | <td> |
| 1918 | 1953 | <ul> |
| 1919 | 1954 | <li>{#link|bool|Primitive Types#}</li> |
| 1920 | 1955 | </ul> |
| 1921 | 1956 | </td> |
| 1922 | 1957 | <td> |
| 1923 | | If {#syntax#}a{#endsyntax#} is {#syntax#}false{#endsyntax#}, returns {#syntax#}false{#endsyntax#} |
| 1924 | | without evaluating {#syntax#}b{#endsyntax#}. Otherwise, returns {#syntax#}b{#endsyntax#}. |
| 1958 | If {#syntax#}a{#endsyntax#} is {#syntax#}false{#endsyntax#}, returns {#syntax#}false{#endsyntax#} |
| 1959 | without evaluating {#syntax#}b{#endsyntax#}. Otherwise, returns {#syntax#}b{#endsyntax#}. |
| 1925 | 1960 | </td> |
| 1926 | 1961 | <td> |
| 1927 | 1962 | <pre>{#syntax#}(false and true) == false{#endsyntax#}</pre> |
| 1928 | 1963 | </td> |
| 1929 | 1964 | </tr> |
| 1930 | 1965 | <tr> |
| 1931 | | <th scope="row"><pre>{#syntax#}a or b{#endsyntax#}</pre></th> |
| 1966 | <td>Logical Or</td> |
| 1967 | <td><pre>{#syntax#}a or b{#endsyntax#}</pre></td> |
| 1932 | 1968 | <td> |
| 1933 | 1969 | <ul> |
| 1934 | 1970 | <li>{#link|bool|Primitive Types#}</li> |
| 1935 | 1971 | </ul> |
| 1936 | 1972 | </td> |
| 1937 | 1973 | <td> |
| 1938 | | If {#syntax#}a{#endsyntax#} is {#syntax#}true{#endsyntax#}, returns {#syntax#}true{#endsyntax#} |
| 1939 | | without evaluating {#syntax#}b{#endsyntax#}. Otherwise, returns {#syntax#}b{#endsyntax#}. |
| 1974 | If {#syntax#}a{#endsyntax#} is {#syntax#}true{#endsyntax#}, |
| 1975 | returns {#syntax#}true{#endsyntax#} without evaluating |
| 1976 | {#syntax#}b{#endsyntax#}. Otherwise, returns |
| 1977 | {#syntax#}b{#endsyntax#}. |
| 1940 | 1978 | </td> |
| 1941 | 1979 | <td> |
| 1942 | 1980 | <pre>{#syntax#}(false or true) == true{#endsyntax#}</pre> |
| 1943 | 1981 | </td> |
| 1944 | 1982 | </tr> |
| 1945 | 1983 | <tr> |
| 1946 | | <th scope="row"><pre>{#syntax#}!a{#endsyntax#}</pre></th> |
| 1984 | <td>Boolean Not</td> |
| 1985 | <td><pre>{#syntax#}!a{#endsyntax#}</pre></td> |
| 1947 | 1986 | <td> |
| 1948 | 1987 | <ul> |
| 1949 | 1988 | <li>{#link|bool|Primitive Types#}</li> |
| 1950 | 1989 | </ul> |
| 1951 | 1990 | </td> |
| 1952 | | <td> |
| 1953 | | Boolean NOT. |
| 1954 | | </td> |
| 1991 | <td></td> |
| 1955 | 1992 | <td> |
| 1956 | 1993 | <pre>{#syntax#}!false == true{#endsyntax#}</pre> |
| 1957 | 1994 | </td> |
| 1958 | 1995 | </tr> |
| 1959 | 1996 | <tr> |
| 1960 | | <th scope="row"><pre>{#syntax#}a == b{#endsyntax#}</pre></th> |
| 1997 | <td>Equality</td> |
| 1998 | <td><pre>{#syntax#}a == b{#endsyntax#}</pre></td> |
| 1961 | 1999 | <td> |
| 1962 | 2000 | <ul> |
| 1963 | 2001 | <li>{#link|Integers#}</li> |
| ... | ... | @@ -1975,7 +2013,8 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 1975 | 2013 | </td> |
| 1976 | 2014 | </tr> |
| 1977 | 2015 | <tr> |
| 1978 | | <th scope="row"><pre>{#syntax#}a == null{#endsyntax#}</pre></th> |
| 2016 | <td>Null Check</td> |
| 2017 | <td><pre>{#syntax#}a == null{#endsyntax#}</pre></td> |
| 1979 | 2018 | <td> |
| 1980 | 2019 | <ul> |
| 1981 | 2020 | <li>{#link|Optionals#}</li> |
| ... | ... | @@ -1990,7 +2029,8 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 1990 | 2029 | </td> |
| 1991 | 2030 | </tr> |
| 1992 | 2031 | <tr> |
| 1993 | | <th scope="row"><pre>{#syntax#}a != b{#endsyntax#}</pre></th> |
| 2032 | <td>Inequality</td> |
| 2033 | <td><pre>{#syntax#}a != b{#endsyntax#}</pre></td> |
| 1994 | 2034 | <td> |
| 1995 | 2035 | <ul> |
| 1996 | 2036 | <li>{#link|Integers#}</li> |
| ... | ... | @@ -2008,7 +2048,8 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 2008 | 2048 | </td> |
| 2009 | 2049 | </tr> |
| 2010 | 2050 | <tr> |
| 2011 | | <th scope="row"><pre>{#syntax#}a != null{#endsyntax#}</pre></th> |
| 2051 | <td>Non-Null Check</td> |
| 2052 | <td><pre>{#syntax#}a != null{#endsyntax#}</pre></td> |
| 2012 | 2053 | <td> |
| 2013 | 2054 | <ul> |
| 2014 | 2055 | <li>{#link|Optionals#}</li> |
| ... | ... | @@ -2023,7 +2064,8 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 2023 | 2064 | </td> |
| 2024 | 2065 | </tr> |
| 2025 | 2066 | <tr> |
| 2026 | | <th scope="row"><pre>{#syntax#}a > b{#endsyntax#}</pre></th> |
| 2067 | <td>Greater Than</td> |
| 2068 | <td><pre>{#syntax#}a > b{#endsyntax#}</pre></td> |
| 2027 | 2069 | <td> |
| 2028 | 2070 | <ul> |
| 2029 | 2071 | <li>{#link|Integers#}</li> |
| ... | ... | @@ -2039,7 +2081,8 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 2039 | 2081 | </td> |
| 2040 | 2082 | </tr> |
| 2041 | 2083 | <tr> |
| 2042 | | <th scope="row"><pre>{#syntax#}a >= b{#endsyntax#}</pre></th> |
| 2084 | <td>Greater or Equal</td> |
| 2085 | <td><pre>{#syntax#}a >= b{#endsyntax#}</pre></td> |
| 2043 | 2086 | <td> |
| 2044 | 2087 | <ul> |
| 2045 | 2088 | <li>{#link|Integers#}</li> |
| ... | ... | @@ -2055,7 +2098,8 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 2055 | 2098 | </td> |
| 2056 | 2099 | </tr> |
| 2057 | 2100 | <tr> |
| 2058 | | <th scope="row"><pre>{#syntax#}a < b{#endsyntax#}</pre></th> |
| 2101 | <td>Less Than</td> |
| 2102 | <td><pre>{#syntax#}a < b{#endsyntax#}</pre></td> |
| 2059 | 2103 | <td> |
| 2060 | 2104 | <ul> |
| 2061 | 2105 | <li>{#link|Integers#}</li> |
| ... | ... | @@ -2071,7 +2115,8 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 2071 | 2115 | </td> |
| 2072 | 2116 | </tr> |
| 2073 | 2117 | <tr> |
| 2074 | | <th scope="row"><pre>{#syntax#}a <= b{#endsyntax#}</pre></th> |
| 2118 | <td>Lesser or Equal</td> |
| 2119 | <td><pre>{#syntax#}a <= b{#endsyntax#}</pre></td> |
| 2075 | 2120 | <td> |
| 2076 | 2121 | <ul> |
| 2077 | 2122 | <li>{#link|Integers#}</li> |
| ... | ... | @@ -2087,14 +2132,14 @@ unwrapped == 1234{#endsyntax#}</pre> |
| 2087 | 2132 | </td> |
| 2088 | 2133 | </tr> |
| 2089 | 2134 | <tr> |
| 2090 | | <th scope="row"><pre>{#syntax#}a ++ b{#endsyntax#}</pre></th> |
| 2135 | <td>Array Concatenation</td> |
| 2136 | <td><pre>{#syntax#}a ++ b{#endsyntax#}</pre></td> |
| 2091 | 2137 | <td> |
| 2092 | 2138 | <ul> |
| 2093 | 2139 | <li>{#link|Arrays#}</li> |
| 2094 | 2140 | </ul> |
| 2095 | 2141 | </td> |
| 2096 | 2142 | <td> |
| 2097 | | Array concatenation. |
| 2098 | 2143 | <ul> |
| 2099 | 2144 | <li>Only available when the lengths of both {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#} are {#link|compile-time known|comptime#}.</li> |
| 2100 | 2145 | </ul> |
| ... | ... | @@ -2108,14 +2153,14 @@ mem.eql(u32, &together, &[_]u32{1,2,3,4}){#endsyntax#}</pre> |
| 2108 | 2153 | </td> |
| 2109 | 2154 | </tr> |
| 2110 | 2155 | <tr> |
| 2111 | | <th scope="row"><pre>{#syntax#}a ** b{#endsyntax#}</pre></th> |
| 2156 | <td>Array Multiplication</td> |
| 2157 | <td><pre>{#syntax#}a ** b{#endsyntax#}</pre></td> |
| 2112 | 2158 | <td> |
| 2113 | 2159 | <ul> |
| 2114 | 2160 | <li>{#link|Arrays#}</li> |
| 2115 | 2161 | </ul> |
| 2116 | 2162 | </td> |
| 2117 | 2163 | <td> |
| 2118 | | Array multiplication. |
| 2119 | 2164 | <ul> |
| 2120 | 2165 | <li>Only available when the length of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#} are {#link|compile-time known|comptime#}.</li> |
| 2121 | 2166 | </ul> |
| ... | ... | @@ -2127,7 +2172,8 @@ mem.eql(u8, pattern, "ababab"){#endsyntax#}</pre> |
| 2127 | 2172 | </td> |
| 2128 | 2173 | </tr> |
| 2129 | 2174 | <tr> |
| 2130 | | <th scope="row"><pre>{#syntax#}a.*{#endsyntax#}</pre></th> |
| 2175 | <td>Pointer Dereference</td> |
| 2176 | <td><pre>{#syntax#}a.*{#endsyntax#}</pre></td> |
| 2131 | 2177 | <td> |
| 2132 | 2178 | <ul> |
| 2133 | 2179 | <li>{#link|Pointers#}</li> |
| ... | ... | @@ -2143,12 +2189,12 @@ ptr.* == 1234{#endsyntax#}</pre> |
| 2143 | 2189 | </td> |
| 2144 | 2190 | </tr> |
| 2145 | 2191 | <tr> |
| 2146 | | <th scope="row"><pre>{#syntax#}&a{#endsyntax#}</pre></th> |
| 2192 | <td>Address Of</td> |
| 2193 | <td><pre>{#syntax#}&a{#endsyntax#}</pre></td> |
| 2147 | 2194 | <td> |
| 2148 | 2195 | All types |
| 2149 | 2196 | </td> |
| 2150 | 2197 | <td> |
| 2151 | | Address of. |
| 2152 | 2198 | </td> |
| 2153 | 2199 | <td> |
| 2154 | 2200 | <pre>{#syntax#}const x: u32 = 1234; |
| ... | ... | @@ -2157,7 +2203,8 @@ ptr.* == 1234{#endsyntax#}</pre> |
| 2157 | 2203 | </td> |
| 2158 | 2204 | </tr> |
| 2159 | 2205 | <tr> |
| 2160 | | <th scope="row"><pre>{#syntax#}a || b{#endsyntax#}</pre></th> |
| 2206 | <td>Error Set Merge</td> |
| 2207 | <td><pre>{#syntax#}a || b{#endsyntax#}</pre></td> |
| 2161 | 2208 | <td> |
| 2162 | 2209 | <ul> |
| 2163 | 2210 | <li>{#link|Error Set Type#}</li> |
| ... | ... | @@ -11376,7 +11423,6 @@ fn readU32Be() u32 {} |
| 11376 | 11423 | {#header_open|Keyword Reference#} |
| 11377 | 11424 | <div class="table-wrapper"> |
| 11378 | 11425 | <table> |
| 11379 | | <caption>Keywords</caption> |
| 11380 | 11426 | <thead> |
| 11381 | 11427 | <tr> |
| 11382 | 11428 | <th scope="col">Keyword</th> |