lib/pedump/sig_parser.rb
# range of common difference between N given sigs
range of common difference between N given sigs
range of common difference between N given sigs
def _diff res
        raise "diff sizes" if res.map(&:size).uniq.size != 1
        size = res.first.size
        dstart  = nil
        dend    = size - 1
        prev_eq = true
        size.times do |i|
          eq = res.map{ |re| re[i] }.uniq.size == 1
          if eq != prev_eq
            if eq
              dend = i-1
            else
              return nil if dstart 
              dstart = i
            end
          end
          prev_eq = eq
        end
        r = dstart..dend
        r == (0..(size-1)) ? nil : r
      end
def _diff res raise "diff sizes" if res . map ( & :size ) . uniq . size != 1 size = res . first . size dstart = nil dend = size - 1 prev_eq = true size . times do | i | eq = res . map { | re | re [ i ] } . uniq . size == 1 if eq != prev_eq if eq dend = i - 1 else return nil if dstart dstart = i end end prev_eq = eq end r = dstart .. dend r == ( 0 .. ( size - 1 ) ) ? nil : r end
range of common difference between N given sigs
range of common difference between N given sigs
# end of current diff # start of new diff # return nil if it's a 2nd diff
res