module WORF

Constants

CompilationUnit

Public Class Methods

unpackSLEB128(io) click to toggle source
# File lib/worf.rb, line 545
def self.unpackSLEB128 io
  result = 0
  shift = 0
  size = 64

  loop do
    byte = io.getbyte
    result |= ((byte & 0x7F) << shift)
    shift += 7
    if (byte >> 7) == 0
      if shift < size && (byte & 0x40) != 0
        result |= (~0 << shift)
      end
      break
    end
  end
  result
end
unpackULEB128(io) click to toggle source
# File lib/worf.rb, line 529
def self.unpackULEB128 io
  result = 0
  shift = 0

  loop do
    byte = io.getbyte
    result |= ((byte & 0x7F) << shift)
    if (byte < 0x80)
      break
    end
    shift += 7
  end

  result
end