ref/ruby/classes/Integer.src/M000019.html in ruby-vpi-15.0.2 vs ref/ruby/classes/Integer.src/M000019.html in ruby-vpi-16.0.0
- old
+ new
@@ -3,29 +3,28 @@
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>split (Integer)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<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 101</span>
-101: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unpack</span> <span class="ruby-identifier">aPackedWidth</span>
-102: <span class="ruby-identifier">bits</span> = <span class="ruby-identifier">length</span>
-103:
-104: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">aPackedWidth</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">bits</span>
-105: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"packed width #{aPackedWidth} must be at least #{bits} for integer #{self}"</span>
-106: <span class="ruby-keyword kw">end</span>
-107:
-108: <span class="ruby-identifier">mask</span> = <span class="ruby-identifier">aPackedWidth</span>.<span class="ruby-identifier">to_mask</span>
-109: <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">self</span> <span class="ruby-operator">&</span> <span class="ruby-identifier">mask</span>
-110:
-111: <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>
-112: <span class="ruby-operator">-</span>((<span class="ruby-operator">-</span><span class="ruby-identifier">result</span>) <span class="ruby-operator">&</span> <span class="ruby-identifier">mask</span>)
-113: <span class="ruby-keyword kw">else</span>
-114: <span class="ruby-identifier">result</span>
-115: <span class="ruby-keyword kw">end</span>
-116: <span class="ruby-keyword kw">end</span></pre>
+ <pre> <span class="ruby-comment cmt"># File lib/ruby-vpi/integer.rb, line 121</span>
+121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">split</span> <span class="ruby-identifier">aWidth</span> = <span class="ruby-value">8</span>
+122: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"width must be positive and non-zero"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">aWidth</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+123:
+124: <span class="ruby-identifier">int</span>, <span class="ruby-identifier">bits</span> = <span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">length</span>
+125: <span class="ruby-identifier">mask</span> = <span class="ruby-identifier">aWidth</span>.<span class="ruby-identifier">to_mask</span>
+126: <span class="ruby-identifier">words</span> = []
+127:
+128: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">bits</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+129: <span class="ruby-identifier">words</span>.<span class="ruby-identifier">unshift</span> <span class="ruby-identifier">int</span> <span class="ruby-operator">&</span> <span class="ruby-identifier">mask</span>
+130: <span class="ruby-identifier">int</span> <span class="ruby-operator">>>=</span> <span class="ruby-identifier">aWidth</span>
+131: <span class="ruby-identifier">bits</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">aWidth</span>
+132: <span class="ruby-keyword kw">end</span>
+133:
+134: <span class="ruby-identifier">words</span>
+135: <span class="ruby-keyword kw">end</span></pre>
</body>
</html>
\ No newline at end of file