doc/api/ruby/classes/Integer.src/M000017.html in ruby-vpi-20.0.0 vs doc/api/ruby/classes/Integer.src/M000017.html in ruby-vpi-21.0.0

- old
+ new

@@ -3,29 +3,23 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>unpack (Integer)</title> + <title>pack (Integer)</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/ruby-vpi/integer.rb, line 76</span> - <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unpack</span> <span class="ruby-identifier">aPackedWidth</span> + <pre><span class="ruby-comment cmt"># File lib/ruby-vpi/integer.rb, line 62</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pack</span> <span class="ruby-identifier">aPackedWidth</span> <span class="ruby-identifier">bits</span> = <span class="ruby-identifier">length</span> + <span class="ruby-identifier">bits</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-comment cmt"># positive integers also have a sign bit (zero)</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">aPackedWidth</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">bits</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;packed width #{aPackedWidth} must be at least #{bits} for integer #{self}&quot;</span> <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">mask</span> = <span class="ruby-identifier">aPackedWidth</span>.<span class="ruby-identifier">to_mask</span> - <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">self</span> <span class="ruby-operator">&amp;</span> <span class="ruby-identifier">mask</span> - - <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>[<span class="ruby-identifier">aPackedWidth</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span> - <span class="ruby-operator">-</span>((<span class="ruby-operator">-</span><span class="ruby-identifier">result</span>) <span class="ruby-operator">&amp;</span> <span class="ruby-identifier">mask</span>) - <span class="ruby-keyword kw">else</span> - <span class="ruby-identifier">result</span> - <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">extend_sign</span>(<span class="ruby-identifier">bits</span>, <span class="ruby-identifier">aPackedWidth</span>) <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file