ref/ruby/classes/Integer.src/M000016.html in ruby-vpi-15.0.2 vs ref/ruby/classes/Integer.src/M000016.html in ruby-vpi-16.0.0
- old
+ new
@@ -3,20 +3,23 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
- <title>ensure_min (Integer)</title>
+ <title>pack (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 70</span>
-70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ensure_min</span> <span class="ruby-identifier">aLimit</span>
-71: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">aLimit</span>
-72: <span class="ruby-identifier">aLimit</span>
-73: <span class="ruby-keyword kw">else</span>
-74: <span class="ruby-keyword kw">self</span>
-75: <span class="ruby-keyword kw">end</span>
-76: <span class="ruby-keyword kw">end</span></pre>
+ <pre> <span class="ruby-comment cmt"># File lib/ruby-vpi/integer.rb, line 62</span>
+62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pack</span> <span class="ruby-identifier">aPackedWidth</span>
+63: <span class="ruby-identifier">bits</span> = <span class="ruby-identifier">length</span>
+64: <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">></span> <span class="ruby-value">0</span> <span class="ruby-comment cmt"># positive integers also have a sign bit (zero)</span>
+65:
+66: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">aPackedWidth</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">bits</span>
+67: <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>
+68: <span class="ruby-keyword kw">end</span>
+69:
+70: <span class="ruby-identifier">extend_sign</span>(<span class="ruby-identifier">bits</span>, <span class="ruby-identifier">aPackedWidth</span>)
+71: <span class="ruby-keyword kw">end</span></pre>
</body>
</html>
\ No newline at end of file