Sha256: bc1f04da34a9a0168f8760580131d7a5d1e1bcb024eead5bbf3d5883d13be267

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>ui_pow (lib/librbdiscrete.rb)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/librbdiscrete.rb, line 42</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ui_pow</span>(<span class="ruby-identifier">base</span>, <span class="ruby-identifier">exp</span>)
    <span class="ruby-identifier">result</span> = <span class="ruby-value">1</span>;
    <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">exp</span>)
        <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">exp</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">1</span>)
            <span class="ruby-identifier">result</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
        <span class="ruby-keyword kw">end</span>
        <span class="ruby-identifier">exp</span> <span class="ruby-operator">&gt;&gt;=</span> <span class="ruby-value">1</span>;
        <span class="ruby-identifier">base</span> <span class="ruby-operator">*=</span> <span class="ruby-identifier">base</span>
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">exp</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>)
        <span class="ruby-identifier">result</span>=<span class="ruby-identifier">base</span>
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
<span class="ruby-keyword kw">end</span></pre>
</body>
</html>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
RubMat-2.1.8 doc/files/lib/librbdiscrete_rb.src/M000002.html