Sha256: ec610ff0d8941837ed14b72af519ec2646a1b018f01c0987a816454a2558137f

Contents?: true

Size: 1.75 KB

Versions: 14

Compression:

Stored size: 1.75 KB

Contents

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

<html>
<head>
  <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 89</span>
89:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pack</span> <span class="ruby-identifier">aPackedWidth</span>
90:     <span class="ruby-identifier">bits</span> = <span class="ruby-identifier">length</span>
91:     <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>
92: 
93:     <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>
94:       <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>
95:     <span class="ruby-keyword kw">end</span>
96: 
97:     <span class="ruby-identifier">extend_sign</span>(<span class="ruby-identifier">bits</span>, <span class="ruby-identifier">aPackedWidth</span>)
98:   <span class="ruby-keyword kw">end</span></pre>
</body>
</html>

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ruby-vpi-12.0.1 ref/ruby/classes/Integer.src/M000022.html
ruby-vpi-11.1.0 ref/ruby/classes/Integer.src/M000022.html
ruby-vpi-12.0.0 ref/ruby/classes/Integer.src/M000022.html
ruby-vpi-11.1.1 ref/ruby/classes/Integer.src/M000022.html
ruby-vpi-14.0.0 ref/ruby/classes/Integer.src/M000018.html
ruby-vpi-12.1.0 ref/ruby/classes/Integer.src/M000022.html
ruby-vpi-12.0.2 ref/ruby/classes/Integer.src/M000022.html
ruby-vpi-13.0.0 ref/ruby/classes/Integer.src/M000018.html
ruby-vpi-15.0.0 ref/ruby/classes/Integer.src/M000018.html
ruby-vpi-15.0.2 ref/ruby/classes/Integer.src/M000018.html
ruby-vpi-15.0.1 ref/ruby/classes/Integer.src/M000018.html
ruby-vpi-8.1.0 ref/ruby/classes/Integer.src/M000020.html
ruby-vpi-9.0.0 ref/ruby/classes/Integer.src/M000022.html
ruby-vpi-8.2.0 ref/ruby/classes/Integer.src/M000021.html