Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 6e204a966e8c42d976f99a1700ce5f20 > files > 3706

ghc-7.4.2-4.mga5.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Bits</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Bits.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">haskell2010-1.1.0.1: Compatibility with Haskell 2010</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe</td></tr></table><p class="caption">Data.Bits</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module defines bitwise operations for signed and unsigned
 integers.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">class</span> (<a href="Prelude.html#t:Eq">Eq</a> a, <a href="Prelude.html#t:Num">Num</a> a) =&gt; <a href="#t:Bits">Bits</a> a  <span class="keyword">where</span><ul class="subs"><li><a href="#v:.-38-.">(.&amp;.)</a> :: a -&gt; a -&gt; a</li><li><a href="#v:.-124-.">(.|.)</a> :: a -&gt; a -&gt; a</li><li><a href="#v:xor">xor</a> :: a -&gt; a -&gt; a</li><li><a href="#v:complement">complement</a> :: a -&gt; a</li><li><a href="#v:shift">shift</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a</li><li><a href="#v:rotate">rotate</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a</li><li><a href="#v:bit">bit</a> :: <a href="Prelude.html#t:Int">Int</a> -&gt; a</li><li><a href="#v:setBit">setBit</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a</li><li><a href="#v:clearBit">clearBit</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a</li><li><a href="#v:complementBit">complementBit</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a</li><li><a href="#v:testBit">testBit</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; <a href="Prelude.html#t:Bool">Bool</a></li><li><a href="#v:bitSize">bitSize</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a></li><li><a href="#v:isSigned">isSigned</a> :: a -&gt; <a href="Prelude.html#t:Bool">Bool</a></li><li><a href="#v:shiftL">shiftL</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a</li><li><a href="#v:shiftR">shiftR</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a</li><li><a href="#v:rotateL">rotateL</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a</li><li><a href="#v:rotateR">rotateR</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a</li></ul></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Prelude.html#t:Eq">Eq</a> a, <a href="Prelude.html#t:Num">Num</a> a) =&gt; <a name="t:Bits" class="def">Bits</a> a  <span class="keyword">where</span><a href="../base-4.5.1.0/src/Data-Bits.html#Bits" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-Bits.html#t:Bits">Bits</a></code> class defines bitwise operations over integral types.
</p><ul><li> Bits are numbered from 0 with bit 0 being the least
  significant bit.
</li></ul><p>Minimal complete definition: <code><a href="Data-Bits.html#v:.-38-.">.&amp;.</a></code>, <code><a href="Data-Bits.html#v:.-124-.">.|.</a></code>, <code><a href="Data-Bits.html#v:xor">xor</a></code>, <code><a href="Data-Bits.html#v:complement">complement</a></code>,
(<code><a href="Data-Bits.html#v:shift">shift</a></code> or (<code><a href="Data-Bits.html#v:shiftL">shiftL</a></code> and <code><a href="Data-Bits.html#v:shiftR">shiftR</a></code>)), (<code><a href="Data-Bits.html#v:rotate">rotate</a></code> or (<code><a href="Data-Bits.html#v:rotateL">rotateL</a></code> and <code><a href="Data-Bits.html#v:rotateR">rotateR</a></code>)),
<code><a href="Data-Bits.html#v:bitSize">bitSize</a></code> and <code><a href="Data-Bits.html#v:isSigned">isSigned</a></code>.
</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:.-38-." class="def">(.&amp;.)</a> :: a -&gt; a -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#.%26." class="link">Source</a></p><div class="doc"><p>Bitwise &quot;and&quot;
</p></div><p class="src"><a name="v:.-124-." class="def">(.|.)</a> :: a -&gt; a -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#.%7C." class="link">Source</a></p><div class="doc"><p>Bitwise &quot;or&quot;
</p></div><p class="src"><a name="v:xor" class="def">xor</a> :: a -&gt; a -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#xor" class="link">Source</a></p><div class="doc"><p>Bitwise &quot;xor&quot;
</p></div><p class="src"><a name="v:complement" class="def">complement</a> :: a -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#complement" class="link">Source</a></p><div class="doc"><p>Reverse all the bits in the argument 
</p></div><p class="src"><a name="v:shift" class="def">shift</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#shift" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-Bits.html#v:shift">shift</a></code> x i</code> shifts <code>x</code> left by <code>i</code> bits if <code>i</code> is positive,
        or right by <code>-i</code> bits otherwise.
        Right shifts perform sign extension on signed number types;
        i.e. they fill the top bits with 1 if the <code>x</code> is negative
        and with 0 otherwise.
</p><p>An instance can define either this unified <code><a href="Data-Bits.html#v:shift">shift</a></code> or <code><a href="Data-Bits.html#v:shiftL">shiftL</a></code> and
        <code><a href="Data-Bits.html#v:shiftR">shiftR</a></code>, depending on which is more convenient for the type in
        question. 
</p></div><p class="src"><a name="v:rotate" class="def">rotate</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#rotate" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-Bits.html#v:rotate">rotate</a></code> x i</code> rotates <code>x</code> left by <code>i</code> bits if <code>i</code> is positive,
        or right by <code>-i</code> bits otherwise.
</p><p>For unbounded types like <code><a href="Prelude.html#t:Integer">Integer</a></code>, <code><a href="Data-Bits.html#v:rotate">rotate</a></code> is equivalent to <code><a href="Data-Bits.html#v:shift">shift</a></code>.
</p><p>An instance can define either this unified <code><a href="Data-Bits.html#v:rotate">rotate</a></code> or <code><a href="Data-Bits.html#v:rotateL">rotateL</a></code> and
        <code><a href="Data-Bits.html#v:rotateR">rotateR</a></code>, depending on which is more convenient for the type in
        question. 
</p></div><p class="src"><a name="v:bit" class="def">bit</a> :: <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#bit" class="link">Source</a></p><div class="doc"><p><code>bit i</code> is a value with the <code>i</code>th bit set and all other bits clear
</p></div><p class="src"><a name="v:setBit" class="def">setBit</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#setBit" class="link">Source</a></p><div class="doc"><p><code>x `setBit` i</code> is the same as <code>x .|. bit i</code>
</p></div><p class="src"><a name="v:clearBit" class="def">clearBit</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#clearBit" class="link">Source</a></p><div class="doc"><p><code>x `clearBit` i</code> is the same as <code>x .&amp;. complement (bit i)</code>
</p></div><p class="src"><a name="v:complementBit" class="def">complementBit</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#complementBit" class="link">Source</a></p><div class="doc"><p><code>x `complementBit` i</code> is the same as <code>x `xor` bit i</code>
</p></div><p class="src"><a name="v:testBit" class="def">testBit</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; <a href="Prelude.html#t:Bool">Bool</a><a href="../base-4.5.1.0/src/Data-Bits.html#testBit" class="link">Source</a></p><div class="doc"><p>Return <code><a href="Prelude.html#v:True">True</a></code> if the <code>n</code>th bit of the argument is 1
</p></div><p class="src"><a name="v:bitSize" class="def">bitSize</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a><a href="../base-4.5.1.0/src/Data-Bits.html#bitSize" class="link">Source</a></p><div class="doc"><p>Return the number of bits in the type of the argument.  The actual
        value of the argument is ignored.  The function <code><a href="Data-Bits.html#v:bitSize">bitSize</a></code> is
        undefined for types that do not have a fixed bitsize, like <code><a href="Prelude.html#t:Integer">Integer</a></code>.
</p></div><p class="src"><a name="v:isSigned" class="def">isSigned</a> :: a -&gt; <a href="Prelude.html#t:Bool">Bool</a><a href="../base-4.5.1.0/src/Data-Bits.html#isSigned" class="link">Source</a></p><div class="doc"><p>Return <code><a href="Prelude.html#v:True">True</a></code> if the argument is a signed type.  The actual
        value of the argument is ignored 
</p></div><p class="src"><a name="v:shiftL" class="def">shiftL</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#shiftL" class="link">Source</a></p><div class="doc"><p>Shift the argument left by the specified number of bits
        (which must be non-negative).
</p><p>An instance can define either this and <code><a href="Data-Bits.html#v:shiftR">shiftR</a></code> or the unified
        <code><a href="Data-Bits.html#v:shift">shift</a></code>, depending on which is more convenient for the type in
        question. 
</p></div><p class="src"><a name="v:shiftR" class="def">shiftR</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#shiftR" class="link">Source</a></p><div class="doc"><p>Shift the first argument right by the specified number of bits. The
        result is undefined for negative shift amounts and shift amounts
        greater or equal to the <code><a href="Data-Bits.html#v:bitSize">bitSize</a></code>.
</p><p>Right shifts perform sign extension on signed number types;
        i.e. they fill the top bits with 1 if the <code>x</code> is negative
        and with 0 otherwise.
</p><p>An instance can define either this and <code><a href="Data-Bits.html#v:shiftL">shiftL</a></code> or the unified
        <code><a href="Data-Bits.html#v:shift">shift</a></code>, depending on which is more convenient for the type in
        question. 
</p></div><p class="src"><a name="v:rotateL" class="def">rotateL</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#rotateL" class="link">Source</a></p><div class="doc"><p>Rotate the argument left by the specified number of bits
        (which must be non-negative).
</p><p>An instance can define either this and <code><a href="Data-Bits.html#v:rotateR">rotateR</a></code> or the unified
        <code><a href="Data-Bits.html#v:rotate">rotate</a></code>, depending on which is more convenient for the type in
        question. 
</p></div><p class="src"><a name="v:rotateR" class="def">rotateR</a> :: a -&gt; <a href="Prelude.html#t:Int">Int</a> -&gt; a<a href="../base-4.5.1.0/src/Data-Bits.html#rotateR" class="link">Source</a></p><div class="doc"><p>Rotate the argument right by the specified number of bits
        (which must be non-negative).
</p><p>An instance can define either this and <code><a href="Data-Bits.html#v:rotateL">rotateL</a></code> or the unified
        <code><a href="Data-Bits.html#v:rotate">rotate</a></code>, depending on which is more convenient for the type in
        question. 
</p></div></div><div class="subs instances"><p id="control.i:Bits" class="caption collapser" onclick="toggleSection('i:Bits')">Instances</p><div id="section.i:Bits" class="show"><table><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Prelude.html#t:Int">Int</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Data-Int.html#t:Int8">Int8</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Data-Int.html#t:Int16">Int16</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Data-Int.html#t:Int32">Int32</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Data-Int.html#t:Int64">Int64</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Prelude.html#t:Integer">Integer</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Data-Word.html#t:Word">Word</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Data-Word.html#t:Word8">Word8</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Data-Word.html#t:Word16">Word16</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Data-Word.html#t:Word32">Word32</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Data-Word.html#t:Word64">Word64</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-Ptr.html#t:WordPtr">WordPtr</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-Ptr.html#t:IntPtr">IntPtr</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CChar">CChar</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CSChar">CSChar</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CUChar">CUChar</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CShort">CShort</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CUShort">CUShort</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CInt">CInt</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CUInt">CUInt</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CLong">CLong</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CULong">CULong</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CLLong">CLLong</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CULLong">CULLong</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CPtrdiff">CPtrdiff</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CSize">CSize</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CWchar">CWchar</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CSigAtomic">CSigAtomic</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CIntPtr">CIntPtr</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CUIntPtr">CUIntPtr</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CIntMax">CIntMax</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Data-Bits.html#t:Bits">Bits</a> <a href="Foreign-C-Types.html#t:CUIntMax">CUIntMax</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>