<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">How could anyone ever argue against this?&nbsp;</div><div class=""><br class=""></div><div class="">+1.</div><div class=""><br class=""></div><div class="">Charles</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 13, 2017, at 2:47 PM, Max Moiseev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi everyone,<div class=""><br class=""></div><div class="">Back in June 2016 we discussed the new design of the integer types for the standard library. It even resulted in acceptance of&nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md" class="">SE-0104</a>&nbsp;for Swift 3. Unfortunately we were not able to implement it in time for the release.</div><div class=""><br class=""></div><div class="">But it was not forgotten, although, as time went by, a few changes needed to be made in order to reflect the current state of the language.</div><div class="">Without further introduction, please welcome the refined proposal to make integers in Swift more suitable for generic programming.</div><div class=""><br class=""></div><div class="">Available in this gist&nbsp;<a href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c" class="">https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c</a>&nbsp;and also inlined below.</div><div class=""><br class=""></div><div class="">Max</div><div class=""><br class=""></div><div class=""><h1 style="box-sizing: border-box; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 1.25; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255); margin-top: 0px !important;" class="">Protocol-oriented integers (take 2)</h1><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><li style="box-sizing: border-box;" class="">Proposal:&nbsp;<a href="https://gist.github.com/moiseev/0000-even-more-improved-integers.md" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">SE-NNNN</a></li><li style="box-sizing: border-box; margin-top: 0.25em;" class="">Authors:&nbsp;<a href="https://github.com/dabrahams" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">Dave Abrahams</a>,&nbsp;<a href="https://github.com/moiseev" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">Maxim Moiseev</a></li><li style="box-sizing: border-box; margin-top: 0.25em;" class="">Review Manager: TBD</li><li style="box-sizing: border-box; margin-top: 0.25em;" class="">Status:&nbsp;<span style="box-sizing: border-box; font-weight: 600;" class="">Awaiting review</span></li><li style="box-sizing: border-box; margin-top: 0.25em;" class="">Bug:&nbsp;<a href="https://bugs.swift.org/browse/SR-3196" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">SR-3196</a></li><li style="box-sizing: border-box; margin-top: 0.25em;" class="">Previous Proposal:&nbsp;<a href="https://gist.github.com/moiseev/0104-improved-integers.md" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">SE-0104</a></li></ul><h2 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; line-height: 1.25; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-introduction" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#introduction" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Introduction</h2><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">This proposal is an evolution of&nbsp;<a href="https://gist.github.com/moiseev/0104-improved-integers.md" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">SE-0104</a>. The goal is still to clean up Swifts integer APIs and make them more useful for generic programming.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The language has evolved in ways that affect integers APIs since the time the original proposal was approved for Swift 3. We also attempted to implement the proposed model in the standard library and found that some essential APIs were missing, whereas others could be safely removed.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Major changes to the APIs introduced by this proposal (as compared to&nbsp;<a href="https://gist.github.com/moiseev/0104-improved-integers.md" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">SE-0104</a>) are listed in a&nbsp;<a href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#whats-new-since-se-0104" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">dedicated section</a>.</p><h2 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; line-height: 1.25; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-motivation" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#motivation" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Motivation</h2><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Swift's integer protocols don't currently provide a suitable basis for generic programming. See&nbsp;<a href="http://blog.krzyzanowskim.com/2015/03/01/swift_madness_of_generic_integer/" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">this blog post</a>&nbsp;for an example of an attempt to implement a generic algorithm over integers.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The way the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Arithmetic</code>&nbsp;protocol is defined, it does not generalize to floating point numbers and also slows down compilation by requiring every concrete type to provide an implementation of arithmetic operators, thus polluting the overload set.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Converting from one integer type to another is performed using the concept of the 'maximum width integer' (see&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">MaxInt</code>), which is an artificial limitation. The very existence of&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">MaxInt</code>&nbsp;makes it unclear what to do should someone implement&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Int256</code>, for example.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Another annoying problem is the inability to use integers of different types in comparison and bit-shift operations. For example, the following snippets won't compile:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> x<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int8</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">42</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> y <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">1</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> z <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">0</span>

x <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">&lt;&lt;=</span> y   <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">//</span> error: binary operator '&lt;&lt;=' cannot be applied to operands of type 'Int8' and 'Int'</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">if</span> x <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">&gt;</span> z { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">...</span> }  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">//</span> error: binary operator '&gt;' cannot be applied to operands of type 'Int8' and 'Int'</span></pre></div><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Currently, bit-shifting a negative number of (or too many) bits causes a trap on some platforms, which makes low-level bit manipulations needlessly dangerous and unpredictable.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Finally, the current design predates many of the improvements that came since Swift 1, and hasn't been revised since then.</p><h2 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; line-height: 1.25; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-proposed-solution" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#proposed-solution" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Proposed solution</h2><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">We propose a new model that does not have above mentioned problems and is more easily extensible.</p><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 16px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: rgb(51, 51, 51);" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; padding: 0px; margin: 0px; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;" class="">                +--------------+  +-------------+
        +------&gt;+  Arithmetic  |  | Comparable  |
        |       |   (+,-,*,/)  |  | (==,&lt;,&gt;,...)|
        |       +-------------++  +---+---------+
        |                     ^       ^
+-------+------------+        |       |
|  SignedArithmetic  |      +-+-------+-----------+
|     (unary -)      |      |    BinaryInteger    |
+------+-------------+      |(words,%,bitwise,...)|
       ^                    ++---+-----+----------+
       |         +-----------^   ^     ^---------------+
       |         |               |                     |
+------+---------++    +---------+---------------+  +--+----------------+
|  SignedInteger  |    |  FixedWidthInteger      |  |  UnsignedInteger  |
|                 |    |(endianness,overflow,...)|  |                   |
+---------------+-+    +-+--------------------+--+  +-+-----------------+
                ^        ^                    ^       ^
                |        |                    |       |
                |        |                    |       |
               ++--------+-+                +-+-------+-+
               |Int family |-+              |UInt family|-+
               +-----------+ |              +-----------+ |
                 +-----------+                +-----------+
</code></pre><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">There are several benefits provided by this model over the old one:</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><li style="box-sizing: border-box;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">It allows mixing integer types in generic functions.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">The possibility to initialize instances of any concrete integer type with values of any other concrete integer type enables writing functions that operate on more than one type conforming to&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BinaryInteger</code>, such as heterogeneous comparisons or bit shifts, described later.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">It removes the overload resolution overhead.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Arithmetic and bitwise operations can now be defined as generic operators on protocols. This approach significantly reduces the number of overloads for those operations, which used to be defined for every single concrete integer type.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">It enables protocol sharing between integer and floating point types.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Note the exclusion of the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">%</code>&nbsp;operation from&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Arithmetic</code>. Its behavior for floating point numbers is sufficiently different from the one for integers that using it in generic context would lead to confusion. The&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">FloatingPoint</code>&nbsp;protocol introduced by&nbsp;<a href="https://gist.github.com/moiseev/0067-floating-point-protocols.md" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">SE-0067</a>&nbsp;should now refine&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">SignedArithmetic</code>.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">It makes future extensions possible.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">The proposed model eliminates the 'largest integer type' concept previously used to interoperate between integer types (see&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">toIntMax</code>&nbsp;in the current model) and instead provides access to machine words. It also introduces the<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">doubleWidthMultiply</code>,&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">doubleWidthDivide</code>, and&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">quotientAndRemainder</code>&nbsp;methods. Together these changes can be used to provide an efficient implementation of bignums that would be hard to achieve otherwise.</p></li></ul><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The implementation of proposed model in the standard library is available&nbsp;<a href="https://github.com/apple/swift/tree/new-integer-protocols" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">in the new-integer-protocols branch</a>.</p><h3 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-a-note-on-bit-shifts" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#a-note-on-bit-shifts" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>A note on bit shifts</h3><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">This proposal introduces the concepts of&nbsp;<em style="box-sizing: border-box;" class="">smart shifts</em>&nbsp;and&nbsp;<em style="box-sizing: border-box;" class="">masking shifts</em>.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The semantics of shift operations are&nbsp;<a href="http://llvm.org/docs/LangRef.html#bitwise-binary-operations" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">often undefined</a>&nbsp;in under- or over-shift cases.&nbsp;<em style="box-sizing: border-box;" class="">Smart shifts</em>, implemented by&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">&gt;&gt;</code>&nbsp;and&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">&lt;&lt;</code>, are designed to address this problem and always behave in a well defined way, as shown in the examples below:</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><li style="box-sizing: border-box;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">x &lt;&lt; -2</code>&nbsp;is equivalent to&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">x &gt;&gt; 2</code></p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">(1 as UInt8) &gt;&gt; 42)</code>&nbsp;will evaluate to&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">0</code></p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">(-128 as Int8) &gt;&gt; 42)</code>&nbsp;will evaluate to&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">0xff</code>&nbsp;or&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">-1</code></p></li></ul><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">In most scenarios, the right hand operand is a literal constant, and branches for handling under- and over-shift cases can be optimized away. For other cases, this proposal provides&nbsp;<em style="box-sizing: border-box;" class="">masking shifts</em>, implemented by&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">&amp;&gt;&gt;</code>&nbsp;and&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">&amp;&lt;&lt;</code>. A masking shift logically preprocesses the right hand operand by masking its bits to produce a value in the range&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">0...(x-1)</code>&nbsp;where&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">x</code>&nbsp;is the number of bits in the left hand operand. On most architectures this masking is already performed by the CPU's shift instructions and has no cost. Both kinds of shift avoid undefined behavior and produce uniform semantics across architectures.</p><h2 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; line-height: 1.25; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-detailed-design" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#detailed-design" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Detailed design</h2><h3 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-whats-new-since-se-0104" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#whats-new-since-se-0104" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>What's new since SE-0104</h3><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><li style="box-sizing: border-box;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><a href="https://gist.github.com/moiseev/0091-improving-operators-in-protocols.md" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">SE-0091</a>&nbsp;removed the necessity to dispatch generic operators through special methods.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">All operators are now declared by protocols as&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">static func</code>s.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Standard Library no longer provides&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">+</code>&nbsp;and&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">-</code>&nbsp;operators for&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Strideable</code>&nbsp;types.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">They were problematic, as one could have written mixed-type code like&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">let x: Int64 = 42; x += (1 as Int)</code>, which would compile, but shouldn't. Besides, since the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Stride</code>&nbsp;of an unsigned type is signed, Standard Library had to implement a hack to make code like&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">let x: UInt = 42; x += (1 as Int)</code>&nbsp;ambiguous. These operators were only necessary because they made advancing collection indices convenient, which is no longer the case since the introduction of the&nbsp;<a href="https://gist.github.com/moiseev/0065-collections-move-indices.md" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">new indexing model</a>&nbsp;in Swift 3.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Shifts and other bitwise operations were moved from&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">FixedWidthInteger</code>&nbsp;to&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BinaryInteger</code>.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Left shift operation on an unbounded integer should infinitely extend the number, and never drop set bits when they reach the most significant position in the underlying representation.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BitwiseOperations</code>&nbsp;protocol was deprecated.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">We believe there are no useful entities that support bitwise operations, but at the same time are not binary integers.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">minimumSignedRepresentationBitWidth</code>&nbsp;property was removed.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">trailingZeros</code>&nbsp;property was added to the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BinaryInteger</code>&nbsp;protocol.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">leadingZeros</code>&nbsp;and&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">popcount</code>&nbsp;properties are still defined by the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">FixedWidthInteger</code>&nbsp;protocol.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Endian-converting initializers and properties were added to the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">FixedWidthInteger</code>&nbsp;protocol.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Standard library introduces the new type&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">DoubleWidth&lt;T&gt;</code>.</p><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">See&nbsp;<a href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#doublewidth" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">this section</a>&nbsp;for more details.</p></li></ul><h3 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-protocols" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#protocols" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Protocols</h3><h4 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 16px; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-arithmetic" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#arithmetic" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: inherit; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Arithmetic</code></h4><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Arithmetic</code>&nbsp;protocol declares binary arithmetic operators â€“ such as&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">+</code>,&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">-</code>, and&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">*</code>&nbsp;— and their mutating counterparts.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">It provides a suitable basis for arithmetic on scalars such as integers and floating point numbers.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Both mutating and non-mutating operations are declared in the protocol, however only the mutating ones are required, as default implementations of the non-mutating ones are provided by a protocol extension.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Magnitude</code>&nbsp;associated type is able to hold the absolute value of any possible value of&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Self</code>. Concrete types do not have to provide a type alias for it, as it can be inferred from the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">magnitude</code>&nbsp;property. This property can be useful in operations that are simpler to implement in terms of unsigned values, for example, printing a value of an integer, which is just printing a '-' character in front of an absolute value.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Please note that for ordinary work, the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">magnitude</code>&nbsp;property&nbsp;<span style="box-sizing: border-box; font-weight: 600;" class="">should not</span>&nbsp;be preferred to the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">abs(_)</code>&nbsp;function, whose return value is of the same type as its argument.</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">protocol</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">Arithmetic</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Equatable</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">ExpressibleByIntegerLiteral</span> </span>{
  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Creates a new instance from the given integer, if it can be represented</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> exactly.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> If the value passed as `source` is not representable exactly, the result</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> is `nil`. In the following example, the constant `x` is successfully</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> created from a value of `100`, while the attempt to initialize the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> constant `y` from `1_000` fails because the `Int8` type can represent</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `127` at maximum:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = Int8(exactly: 100)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == Optional(100)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = Int8(exactly: 1_000)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == nil</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter source: A floating-point value to convert to an integer.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init?</span>&lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">T</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">exactly</span> <span class="pl-smi" style="box-sizing: border-box;">source</span>: T)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> A type that can represent the absolute value of any possible value of the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> conforming type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">associatedtype</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Magnitude</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Equatable</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">ExpressibleByIntegerLiteral</span></span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The magnitude of this value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For any numeric value `x`, `x.magnitude` is the absolute value of `x`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> You can use the `magnitude` property in operations that are simpler to</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> implement in terms of unsigned values, such as printing the value of an</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> integer, which is just printing a '-' character in front of an absolute</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = -200</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x.magnitude == 200</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The global `abs(_:)` function provides more familiar syntax when you need</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> to find an absolute value. In addition, because `abs(_:)` always returns</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> a value of the same type, even in a generic context, using the function</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> instead of the `magnitude` property is encouraged.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `abs(_:)`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> magnitude<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> Magnitude { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the sum of the two given values.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The sum of `lhs` and `rhs` must be representable in the same type. In the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> following example, the result of `100 + 200` is greater than the maximum</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> representable `Int8` value:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: Int8 = 10 + 21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 31</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y: Int8 = 100 + 121</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // Overflow error</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">+</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Adds the given value to this value in place.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For example:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     var x = 15</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     y += 7</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == 22</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">+=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the difference of the two given values.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The difference of `lhs` and `rhs` must be representable in the same type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> In the following example, the result of `10 - 21` is less than zero, the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> minimum representable `UInt` value:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt = 21 - 10</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 11</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y: UInt = 10 - 21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // Overflow error</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">-</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Subtracts the given value from this value in place.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For example:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     var x = 15</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     y -= 7</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == 8</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">-=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the product of the two given values.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The product of `lhs` and `rhs` must be representable in the same type. In</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the following example, the result of `10 * 50` is greater than the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> maximum representable `Int8` value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: Int8 = 10 * 5</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 50</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y: Int8 = 10 * 50</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // Overflow error</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">*</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Multiples this value by the given value in place.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For example:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     var x = 15</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     y *= 7</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == 105</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">*=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the quotient of dividing the first value by the second.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For integer types, any remainder of the division is discarded.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = 21 / 5</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 4</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">/</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Divides this value by the given value in place.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For example:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     var x = 15</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     y /= 7</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == 2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">/=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)
}

<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">Arithmetic</span> {
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init</span>() { <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">self</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">0</span> }

  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">prefix</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">+</span> (<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">x</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span> {
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">return</span> x
  }
}</pre></div><h4 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 16px; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-signedarithmetic" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#signedarithmetic" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: inherit; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">SignedArithmetic</code></h4><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">SignedArithmetic</code>&nbsp;protocol is for numbers that can be negated.</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">protocol</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">SignedArithmetic</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">Arithmetic </span>{
  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the additive inverse of this value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = 21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = -x</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == -21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: The additive inverse of this value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `negate()`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">prefix</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">-</span> (<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">operand</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Replaces this value with its additive inverse.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The following example uses the `negate()` method to negate the value of</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> an integer `x`:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     var x = 21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     x.negate()</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == -21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: The unary minus operator (`-`).</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">mutating</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">negate</span>()
}

<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">SignedArithmetic</span> {
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">prefix</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">-</span> (<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">operand</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span> {
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> result <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> operand
    result.<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">negate</span>()
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">return</span> result
  }

  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">mutating</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">negate</span>() {
    <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">self</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>() <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">self</span>
  }
}</pre></div><h4 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 16px; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-binaryinteger" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#binaryinteger" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: inherit; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BinaryInteger</code></h4><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BinaryInteger</code>&nbsp;protocol is the basis for all the integer types provided by the standard library.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">This protocol adds a few new initializers. Two of them allow to create integers from floating point numbers, others support construction from instances of any type conforming to&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BinaryInteger</code>, using different strategies:</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><li style="box-sizing: border-box;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Initialize&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Self</code>&nbsp;with the value, provided that the value is representable. The precondition should be satisfied by the caller.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Extend or truncate the value to fit into&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Self</code></p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Clamp the value to the representable range of&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Self</code></p></li></ul><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BinaryInteger</code>&nbsp;also declares bitwise and shift operators.</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">protocol</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span> :<span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);"></span>
<span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">  <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Comparable</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Hashable</span>, Arithmetic, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">CustomStringConvertible</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Strideable</span> </span>{

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> A Boolean value indicating whether this type is a signed integer type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> *Signed* integer types can represent both positive and negative values.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> *Unsigned* integer types can represent only nonnegative values.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> isSigned<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Bool</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Creates an integer from the given floating-point value, if it can be</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> represented exactly.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> If the value passed as `source` is not representable exactly, the result</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> is `nil`. In the following example, the constant `x` is successfully</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> created from a value of `21.0`, while the attempt to initialize the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> constant `y` from `21.5` fails:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = Int(exactly: 21.0)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == Optional(21)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = Int(exactly: 21.5)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == nil</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter source: A floating-point value to convert to an integer.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init?</span>&lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">T</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">FloatingPoint</span></span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">exactly</span> <span class="pl-smi" style="box-sizing: border-box;">source</span>: T)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Creates an integer from the given floating-point value, truncating any</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> fractional part.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Truncating the fractional part of `source` is equivalent to rounding</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> toward zero.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = Int(21.5)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = Int(-21.5)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == -21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> If `source` is outside the bounds of this type after truncation, a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> runtime error may occur.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z = UInt(-21.5)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // Error: ...the result would be less than UInt.min</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter source: A floating-point value to convert to an integer.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   `source` must be representable in this type after truncation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init</span>&lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">T</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">FloatingPoint</span></span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">source</span>: T)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Creates an new instance from the given integer.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> If the value passed as `source` is not representable in this type, a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> runtime error may occur.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = -500 as Int</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = Int32(x)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == -500</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // -500 is not representable as a 'UInt32' instance</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z = UInt32(x)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // Error</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter source: An integer to convert. `source` must be representable</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   in this type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init</span>&lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">T</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">source</span>: T)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Creates a new instance from the bit pattern of the given instance by</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> sign-extending or truncating to fit this type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> When the bit width of `T` (the type of `source`) is equal to or greater</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> than this type's bit width, the result is the truncated</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> least-significant bits of `source`. For example, when converting a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> 16-bit value to an 8-bit type, only the lower 8 bits of `source` are</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> used.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let p: Int16 = -500</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // 'p' has a binary representation of 11111110_00001100</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let q = Int8(extendingOrTruncating: p)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // q == 12</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // 'q' has a binary representation of 00001100</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> When the bit width of `T` is less than this type's bit width, the result</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> is *sign-extended* to fill the remaining bits. That is, if `source` is</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> negative, the result is padded with ones; otherwise, the result is</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> padded with zeros.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let u: Int8 = 21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // 'u' has a binary representation of 00010101</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let v = Int16(extendingOrTruncating: u)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // v == 21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // 'v' has a binary representation of 00000000_00010101</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let w: Int8 = -21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // 'w' has a binary representation of 11101011</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = Int16(extendingOrTruncating: w)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == -21</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // 'x' has a binary representation of 11111111_11101011</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = UInt16(extendingOrTruncating: w)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == 65515</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // 'y' has a binary representation of 11111111_11101011</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter source: An integer to convert to this type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init</span>&lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">T</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">extendingOrTruncating</span> <span class="pl-smi" style="box-sizing: border-box;">source</span>: T)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Creates a new instance with the representable value that's closest to the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> given integer.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> If the value passed as `source` is greater than the maximum representable</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> value in this type, the result is the type's `max` value. If `source` is</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> less than the smallest representable value in this type, the result is</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the type's `min` value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> In this example, `x` is initialized as an `Int8` instance by clamping</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `500` to the range `-128...127`, and `y` is initialized as a `UInt`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> instance by clamping `-500` to the range `0...UInt.max`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = Int8(clamping: 500)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 127</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == Int8.max</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = UInt(clamping: -500)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == 0</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter source: An integer to convert to this type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init</span>&lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">T</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">clamping</span> <span class="pl-smi" style="box-sizing: border-box;">source</span>: T)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the n-th word, counting from the least significant to most</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> significant, of this value's binary representation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The `word(at:)` method returns negative values in two's complement</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> representation, regardless of a type's underlying implementation. If `n`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> is greater than the number of words in this value's current</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> representation, the result is `0` for positive numbers and `~0` for</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> negative numbers.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter n: The word to return, counting from the least significant to</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   most significant. `n` must be greater than or equal to zero.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: An word-sized, unsigned integer with the bit pattern of the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   n-th word of this value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">word</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">at</span> <span class="pl-smi" style="box-sizing: border-box;">n</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">UInt</span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The number of bits in the current binary representation of this value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> This property is a constant for instances of fixed-width integer</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> types.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> bitWidth <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The number of trailing zeros in this value's binary representation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For example, in a fixed-width integer type with a `bitWidth` value of 8,</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the number -8 has three trailing zeros.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = Int8(bitPattern: 0b1111_1000)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == -8</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x.trailingZeros == 3</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> trailingZeros<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the remainder of dividing the first value by the second.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The result has the same sign as `lhs` and is less than `rhs.magnitude`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = 22 % 5</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = 22 % -5</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == 2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z = -22 % -5</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // z == -2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameters:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   - lhs: The value to divide.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   - rhs: The value to divide `lhs` by. `rhs` must not be zero.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">%</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Replaces this value with the remainder of itself divided by the given</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> value. For example:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     var x = 15</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     x %= 7</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 1</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter rhs: The value to divide this value by. `rhs` must not be</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   zero.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `remainder(dividingBy:)`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">%=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the inverse of the bits set in the argument.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The bitwise NOT operator (`~`) is a prefix operator that returns a value</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> in which all the bits of its argument are flipped: Bits that are `1` in</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the argument are `0` in the result, and bits that are `0` in the argument</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> are `1` in the result. This is equivalent to the inverse of a set. For</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> example:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt8 = 5        // 0b00000101</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let notX = ~x           // 0b11111010</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Performing a bitwise NOT operation on 0 returns a value with every bit</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> set to `1`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let allOnes = ~UInt8.min   // 0b11111111</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Complexity: O(1).</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">prefix</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">~</span> (<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">x</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the result of performing a bitwise AND operation on this value</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> and the given value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> A bitwise AND operation results in a value that has each bit set to `1`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> where *both* of its arguments have that bit set to `1`. For example:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt8 = 5          // 0b00000101</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y: UInt8 = 14         // 0b00001110</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z = x &amp; y             // 0b00000100</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the result of performing a bitwise OR operation on this value and</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the given value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> A bitwise OR operation results in a value that has each bit set to `1`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> where *one or both* of its arguments have that bit set to `1`. For</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> example:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt8 = 5          // 0b00000101</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y: UInt8 = 14         // 0b00001110</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z = x | y             // 0b00001111</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">|</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">|=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the result of performing a bitwise XOR operation on this value</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> and the given value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> A bitwise XOR operation, also known as an exclusive OR operation, results</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> in a value that has each bit set to `1` where *one or the other but not</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> both* of its arguments had that bit set to `1`. For example:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt8 = 5          // 0b00000101</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y: UInt8 = 14         // 0b00001110</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z = x ^ y             // 0b00001011</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">^</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">^=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the result of shifting this value's binary representation the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> specified number of digits to the right.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> In a *masking shift*, the bit pattern of the value passed as `rhs` is</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> masked to produce a value between zero and the bit width of `lhs`. The</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> shift is performed using this masked value. Masking shifts require more</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> care to use correctly than a traditional bit shift, but are likely to be</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> more efficient when used with shift amounts that are not compile-time</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> constants. On most architectures, a masking shift compiles down to a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> single instruction.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For example, if you shift an 8-bit, unsigned integer by 2, the shift</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> amount requires no masking.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt8 = 30                 // 0b00011110</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = x &amp;&gt;&gt; 2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == 7                         // 0b00000111</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> However, if you shift it by 11, it first bitmasks `rhs` to `3`, and then</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> uses that masked value as the number of bits to shift `x`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z = x &amp;&gt;&gt; 11</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // z == 3                         // 0b00000011</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Relationship to the Right Shift Operator</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> ----------------------------------------</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The masking right shift operator handles attempted overshifts and</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> undershifts differently from the right shift operator (`&gt;&gt;`). When the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> value passed as `rhs` in a masking shift is within the range</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `0...&lt;bitWidth`, the operation is equivalent to using the right shift</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> operator.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt8 = 30                 // 0b00011110</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y1 = x &amp;&gt;&gt; 2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y1 == 7                        // 0b00000111</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y2 = x &gt;&gt; 2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y2 == 7                        // 0b00000111</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The right shift operator does not mask its right-hand-side argument, so</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> passing `11` as `rhs` shifts all the bits of `x` to zero.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z1 = x &amp;&gt;&gt; 11</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // z1 == 240                      // 0b00000011</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z2 = x &gt;&gt; 11</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // z2 == 0                        // 0b00000000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter rhs: The number of bits to shift this value to the right. If</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   `rhs` is outside the range `0..&lt;bitWidth`, it is masked to produce a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   value within that range.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: The result of shifting this value by the masked `rhs` to the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   right.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `&amp;&lt;&lt;`, `&gt;&gt;`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;&gt;&gt;</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;&gt;&gt;=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the result of shifting this value's binary representation the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> specified number of digits to the left.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> In a *masking shift*, the bit pattern of the value passed as `rhs` is</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> masked to produce a value between zero and the bit width of `lhs`. The</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> shift is performed using this masked value. Masking shifts require more</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> care to use correctly than a traditional bit shift, but are likely to be</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> more efficient when used with shift amounts that are not compile-time</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> constants. On most architectures, a masking shift compiles down to a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> single instruction.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For example, if you shift an 8-bit, unsigned integer by 2, the shift</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> amount requires no masking.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt8 = 30                 // 0b00011110</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y = x &amp;&gt;&gt; 2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y == 120                       // 0b01111000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> However, if you shift it by 11, it first bitmasks `rhs` to `3`, and then</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> uses that masked value as the number of bits to shift `x`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z = x &amp;&lt;&lt; 11</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // z == 240                       // 0b11110000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Relationship to the Left Shift Operator</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> ---------------------------------------</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The masking left shift operator handles attempted overshifts and</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> undershifts differently from the left shift operator (`&lt;&lt;`). When the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> value passed as `rhs` in a masking shift is within the range</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `0...&lt;bitWidth`, the operation is equivalent to using the left shift</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> operator.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt8 = 30                 // 0b00011110</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y1 = x &amp;&lt;&lt; 2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y1 == 120                      // 0b01111000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y2 = x &lt;&lt; 2</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // y2 == 120                      // 0b01111000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The left shift operator does not mask its right-hand-side argument, so</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> passing `11` as `rhs` shifts all the bits of `x` to zero.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z1 = x &amp;&lt;&lt; 11</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // z1 == 240                      // 0b11110000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z2 = x &lt;&lt; 11</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // z2 == 0                        // 0b00000000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter rhs: The number of bits to shift this value to the left. If</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   `rhs` is outside the range `0..&lt;bitWidth`, it is masked to produce a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   value within that range.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: The result of shifting this value by the masked `rhs` to the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   left.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `&amp;&gt;&gt;`, `&lt;&lt;`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;&lt;&lt;</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;&lt;&lt;=</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the quotient and remainder of this value divided by the given</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Use this method to calculate the quotient and remainder of a division at</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the same time.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x = 1_000_000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let (q, r) = x.quotientAndRemainder(dividingBy: 933)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // q == 1071</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // r == 757</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter rhs: The value to divide this value by.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: A tuple containing the quotient and remainder of this value</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   divided by `rhs`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">quotientAndRemainder</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">dividingBy</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> (<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">quotient</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">remainder</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns `-1` if this value is negative and `1` if it's positive;</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> otherwise, `0`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: The sign of this number, expressed as an integer of the same</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">signum</span>() <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
}</pre></div><h4 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 16px; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-fixedwidthinteger" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#fixedwidthinteger" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: inherit; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">FixedWidthInteger</code></h4><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">FixedWidthInteger</code>&nbsp;protocol adds the notion of endianness as well as static properties for type bounds and bit width.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">WithOverflow</code>&nbsp;family of methods is used in default implementations of mutating arithmetic methods (see the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Arithmetic</code>&nbsp;protocol). Having these methods allows the library to provide both bounds-checked and masking implementations of arithmetic operations, without duplicating code.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">doubleWidthMultiply</code>&nbsp;and&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">doubleWidthDivide</code>&nbsp;methods are necessary building blocks to implement support for integer types of a greater width such as arbitrary-precision integers.</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">protocol</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">FixedWidthInteger</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger </span>{
  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The number of bits used for the underlying binary representation of</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> values of this type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> An unsigned, fixed-width integer type can represent values from 0 through</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `(2 ** bitWidth) - 1`, where `**` is exponentiation. A signed,</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> fixed-width integer type can represent values from</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `-(2 ** bitWidth - 1)` through `(2 ** bitWidth - 1) - 1`. For example,</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the `Int8` type has a `bitWidth` value of 8 and can store any integer in</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the range `-128...127`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> bitWidth <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The maximum representable integer in this type.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For unsigned integer types, this value is `(2 ** bitWidth) - 1`, where</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `**` is exponentiation. For signed integer types, this value is</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `(2 ** bitWidth - 1) - 1`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> max<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The minimum representable value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For unsigned integer types, this value is always `0`. For signed integer</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> types, this value is `-(2 ** bitWidth - 1)`, where `**` is</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> exponentiation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> min<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the sum of this value and the given value along with a flag</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> indicating whether overflow occurred in the operation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter other: The value to add to this value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: A tuple containing the result of the addition along with a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   flag indicating whether overflow occurred. If the `overflow` component</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   is `.none`, the `partialValue` component contains the entire sum. If</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   the `overflow` component is `.overflow`, an overflow occurred and the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   `partialValue` component contains the truncated sum of this value and</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   `other`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `+`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">addingWithOverflow</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">other</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> (<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">partialValue</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">overflow</span>: ArithmeticOverflow)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the difference of this value and the given value along with a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> flag indicating whether overflow occurred in the operation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter other: The value to subtract from this value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: A tuple containing the result of the subtraction along with a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   flag indicating whether overflow occurred. If the `overflow` component</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   is `.none`, the `partialValue` component contains the entire</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   difference. If the `overflow` component is `.overflow`, an overflow</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   occurred and the `partialValue` component contains the truncated</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   result of `other` subtracted from this value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `-`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">subtractingWithOverflow</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">other</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> (<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">partialValue</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">overflow</span>: ArithmeticOverflow)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the product of this value and the given value along with a flag</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> indicating whether overflow occurred in the operation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter other: The value to multiply by this value.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: A tuple containing the result of the multiplication along with</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   a flag indicating whether overflow occurred. If the `overflow`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   component is `.none`, the `partialValue` component contains the entire</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   product. If the `overflow` component is `.overflow`, an overflow</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   occurred and the `partialValue` component contains the truncated</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   product of this value and `other`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `*`, `doubleWidthMultiply(_:_:)`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">multipliedWithOverflow</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">by</span> <span class="pl-smi" style="box-sizing: border-box;">other</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> (<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">partialValue</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">overflow</span>: ArithmeticOverflow)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns the quotient of dividing this value by the given value along with</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> a flag indicating whether overflow occurred in the operation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For a value `x`, if zero is passed as `other`, the result is</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `(x, .overflow)`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameter other: The value to divide this value by.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: A tuple containing the result of the division along with a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   flag indicating whether overflow occurred. If the `overflow` component</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   is `.none`, the `partialValue` component contains the entire quotient.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   If the `overflow` component is `.overflow`, an overflow occurred and</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   the `partialValue` component contains the truncated quotient.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `/`, `doubleWidthDivide(_:_:)`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">dividedWithOverflow</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">by</span> <span class="pl-smi" style="box-sizing: border-box;">other</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> (<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">partialValue</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">overflow</span>: ArithmeticOverflow)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns a tuple containing the high and low parts of the result of</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> multiplying its arguments.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Use this method to calculate the full result of a product that would</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> otherwise overflow. Unlike traditional truncating multiplication, the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `doubleWidthMultiply(_:_:)` method returns both the `high` and `low`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> parts of the product of `lhs` and `rhs`. The following example uses this</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> method to multiply two `UInt8` values that normally overflow when</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> multiplied:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: UInt8 = 100</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let y: UInt8 = 20</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let result = UInt8.doubleWidthMultiply(100, 20)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // result.high == 0b00000111</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // result.low  == 0b11010000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The product of `x` and `y` is 2000, which is too large to represent in a</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> `UInt8` instance. The `high` and `low` components of the `result` tuple</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> represent 2000 when concatenated to form a double-width integer; that</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> is, using `result.high` as the high byte and `result.low` as the low byte</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> of a `UInt16` instance.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let z = UInt16(result.high) &lt;&lt; 8 | UInt16(result.low)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // z == 2000</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameters:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   - lhs: A value to multiply.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   - rhs: Another value to multiply.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: A tuple containing the high and low parts of the result of</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   multiplying `lhs` and `rhs`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `multipliedWithOverflow(by:)`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">doubleWidthMultiply</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> (<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">high</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">low</span>: Magnitude)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Returns a tuple containing the quotient and remainder of dividing the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> first argument by the second.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The resulting quotient must be representable within the bounds of the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> type. If the quotient of dividing `lhs` by `rhs` is too large to</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> represent in the type, a runtime error may occur.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Parameters:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   - lhs: A tuple containing the high and low parts of a double-width</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     integer. The `high` component of the tuple carries the sign, if the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     type is signed.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   - rhs: The integer to divide into `lhs`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - Returns: A tuple containing the quotient and remainder of `lhs` divided</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>   by `rhs`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">doubleWidthDivide</span>(
    <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">lhs</span>: (high: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, low: Magnitude), <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">_</span> <span class="pl-smi" style="box-sizing: border-box;">rhs</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> (<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">quotient</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">remainder</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The number of bits equal to 1 in this value's binary representation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For example, in a fixed-width integer type with a `bitWidth` value of 8,</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the number 31 has five bits equal to 1.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: Int8 = 0b0001_1111</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 31</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x.popcount == 5</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> popcount<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The number of leading zeros in this value's binary representation.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> For example, in a fixed-width integer type with a `bitWidth` value of 8,</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> the number 31 has three leading zeros.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     let x: Int8 = 0b0001_1111</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x == 31</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span>     // x.leadingZeros == 3</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `BinaryInteger.trailingZeros`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> leadingZeros<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Creates an integer from its big-endian representation, changing the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> byte order if necessary.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">bigEndian</span> <span class="pl-smi" style="box-sizing: border-box;">value</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> Creates an integer from its little-endian representation, changing the</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> byte order if necessary.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">littleEndian</span> <span class="pl-smi" style="box-sizing: border-box;">value</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The big-endian representation of this integer.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> If necessary, the byte order of this value is reversed from the typical</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> byte order of this integer type. On a big-endian platform, for any</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> integer `x`, `x == x.bigEndian`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `littleEndian`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> bigEndian<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> The little-endian representation of this integer.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> If necessary, the byte order of this value is reversed from the typical</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> byte order of this integer type. On a little-endian platform, for any</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> integer `x`, `x == x.littleEndian`.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">///</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> - SeeAlso: `bigEndian`</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> littleEndian<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">///</span> A representation of this integer with the byte order swapped.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> byteSwapped<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }
}</pre></div><h4 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 16px; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-auxiliary-protocols" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#auxiliary-protocols" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Auxiliary protocols</h4><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">protocol</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">UnsignedInteger</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger </span>{
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">associatedtype</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Magnitude</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>
}
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">protocol</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">SignedInteger</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger, SignedArithmetic </span>{
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">associatedtype</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Magnitude</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>
}</pre></div><h3 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-doublewidth" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#doublewidth" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>DoubleWidth</h3><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">DoubleWidth&lt;T&gt;</code>&nbsp;type allows to create wider fixed-width integer types from the ones available in the standard library.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Standard library currently provides fixed-width integer types of up to 64 bits. A value of&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">DoubleWidth&lt;Int64&gt;</code>&nbsp;will double the range of the underlying type and implement all the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">FixedWidthInteger</code>&nbsp;requirements.&nbsp;<em style="box-sizing: border-box;" class="">Please note</em>&nbsp;though that the implementation will not necessarily be the most efficient one, so it would not be a good idea to use&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">DoubleWidth&lt;Int32&gt;</code>instead of a built-in&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Int64</code>.</p><h3 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-extra-operators" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#extra-operators" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Extra operators</h3><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">In addition to the operators described in the&nbsp;<a href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#protocols" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;" class="">protocols section</a>, we also provide a few extensions that are not protocol requirements:</p><h4 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 16px; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-heterogeneous-shifts" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#heterogeneous-shifts" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Heterogeneous shifts</h4><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span> {
  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">//</span> Masking shifts</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;&gt;&gt;</span>  &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;&gt;&gt;=</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other)
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;&lt;&lt;</span>  &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;&lt;&lt;=</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other)

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">//</span> 'Smart' shifts</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&gt;&gt;</span>  &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&gt;&gt;=</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other)
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&lt;&lt;</span>  &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&lt;&lt;=</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">inout</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other)
}</pre></div><h4 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 16px; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-heterogeneous-equality-and-comparison" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#heterogeneous-equality-and-comparison" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Heterogeneous equality and comparison</h4><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span> {
  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">//</span> Equality</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">==</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Bool</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">!=</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Bool</span>

  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">//</span> Comparison</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span>  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&lt;</span>  &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Bool</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&lt;=</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Bool</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&gt;</span>  &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Bool</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&gt;=</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Other</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">BinaryInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Self</span>, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: Other) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Bool</span>
}</pre></div><h4 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 16px; line-height: 1.25; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-masking-arithmetic" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#masking-arithmetic" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Masking arithmetic</h4><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;*</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">T</span>: <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">FixedWidthInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: T, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: T) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> T
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;-</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">T</span>: <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">FixedWidthInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: T, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: T) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> T
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">&amp;+</span> &lt;<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">T</span>: <span class="pl-e" style="box-sizing: border-box; color: rgb(121, 93, 163);">FixedWidthInteger</span>&gt;(<span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">lhs</span></span>: T, <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);"><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">rhs</span></span>: T) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> T</pre></div><h2 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; line-height: 1.25; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-non-goals" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#non-goals" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Non-goals</h2><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">This proposal:</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><li style="box-sizing: border-box;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><em style="box-sizing: border-box;" class="">DOES NOT</em>&nbsp;solve the integer promotion problem, which would allow mixed-type arithmetic. However, we believe that it is an important step in the right direction.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class=""><em style="box-sizing: border-box;" class="">DOES NOT</em>&nbsp;include the implementation of a&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BigInt</code>&nbsp;type, but allows it to be implemented in the future.</p></li></ul><h2 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; line-height: 1.25; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-source-compatibility" class="anchor" href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c#source-compatibility" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Source compatibility</h2><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The proposed change is designed to be as non-breaking as possible, and it has been proven that it does not break code on concrete integer types. However, there are still a few API breaking changes in the realm of generic code:</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255); margin-bottom: 0px !important;" class=""><li style="box-sizing: border-box;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Integer protocols in Swift up to and including version 3 were not particularly useful for generic programming, but were rather a means of sharing implementation between conforming types. Therefore we believe the amount of code that relied on these protocols is relatively small. The breakage can be further reduced by introducing proper aliases for the removed protocols with deprecation warnings.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Deprecation of the&nbsp;<code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">BitwiseOperations</code>&nbsp;protocol. We find it hard to imagine a type that conforms to this protocol, but is&nbsp;<em style="box-sizing: border-box;" class="">not</em>&nbsp;a binary integer type.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Addition of 'smart' shifts will change the behavior of existing code. It will still compile, but will be potentially less performant due to extra logic involved. In a case, where this becomes a problem, newly introduced masking shift operators can be used instead. Unfortunately, performance characteristics of the code cannot be statically checked, and thus migration cannot be provided.</p></li></ul><div class=""><br class=""></div></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>