Sha256: a5bf8957ee085a53d558351db44ae63bf8016184391f7afc5d372d58aaec42cb

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

module Apache
  module Hadoop
    module Hbase
      module Thrift


        class TCell
          def to_i16
            val, = value.unpack('n')
            (val > 0x7fff) ? (0 - ((val - 1) ^ 0xffff)) : val
          end

          def to_i32
            val, = value.unpack('N')
            (val > 0x7fffffff) ? (0 - ((val - 1) ^ 0xffffffff)) : val
          end
          
          def to_i64
            hi, lo = value.unpack('N2')
            if (hi > 0x7fffffff)
              hi ^= 0xffffffff
              lo ^= 0xffffffff
              0 - (hi << 32) - lo - 1
            else
              (hi << 32) + lo
            end
          end
          
          def to_double
            value.unpack('G').first
          end
          
        end


      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hbaserb-0.0.5 lib/hbaserb/extensions.rb
hbaserb-0.0.4 lib/hbaserb/extensions.rb
hbaserb-0.0.3 lib/hbaserb/extensions.rb
hbaserb-0.0.2 lib/hbaserb/extensions.rb
hbaserb-0.0.1 lib/hbaserb/extensions.rb