Method: Fisk::OperandSize#compute_size

Defined in:
lib/fisk.rb

#compute_size(type) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fisk.rb', line 24

def compute_size type
  return 128 if type.start_with?('xmm')

  bits = type[/^r(\d+)$/, 1]&.to_i

  if bits.nil?
    raise ArgumentError, "Unexpected register type (#{type}); 'r<bits>' expected"
  elsif bits % 8 != 0
    raise ArgumentError, "Unexpected register size (#{bits}); multiple of 8 expected"
  else
    bits
  end
end