move fits_u8 to integer constant (from numberic)
This commit is contained in:
parent
95c7e44342
commit
e7f7f9c319
@ -29,7 +29,7 @@ module Arm
|
||||
arg = Register::RegisterReference.new( arg )
|
||||
end
|
||||
if (arg.is_a?(Virtual::IntegerConstant))
|
||||
if (arg.integer.fits_u8?)
|
||||
if (arg.fits_u8?)
|
||||
# no shifting needed
|
||||
operand = arg.integer
|
||||
immediate = 1
|
||||
|
@ -78,7 +78,7 @@ module Arm
|
||||
else
|
||||
u8_imm = parts[1].to_i(2)
|
||||
end
|
||||
if (u8_imm.fits_u8?)
|
||||
if (Virtual::IntegerConstant.new(u8_imm).fits_u8?)
|
||||
# can do!
|
||||
rot_imm = (pre_zeros+imm_len) / 2
|
||||
if (rot_imm > 15)
|
||||
|
@ -31,7 +31,7 @@ module Arm
|
||||
right = Virtual::IntegerConstant.new( right )
|
||||
end
|
||||
if (right.is_a?(Virtual::IntegerConstant))
|
||||
if true #TODO (right.integer.fits_u8?)
|
||||
if true #TODO (right.fits_u8?)
|
||||
# no shifting needed
|
||||
operand = right.integer
|
||||
immediate = 1
|
||||
|
@ -35,7 +35,7 @@ module Arm
|
||||
right = Virtual::IntegerConstant.new( r_pos - self.position - 8 )
|
||||
end
|
||||
if (right.is_a?(Virtual::IntegerConstant))
|
||||
if (right.integer.fits_u8?)
|
||||
if (right.fits_u8?)
|
||||
return true
|
||||
elsif (calculate_u8_with_rr(right))
|
||||
return true
|
||||
@ -63,7 +63,7 @@ module Arm
|
||||
rn = :pc
|
||||
end
|
||||
if (right.is_a?(Virtual::IntegerConstant))
|
||||
if (right.integer.fits_u8?)
|
||||
if (right.fits_u8?)
|
||||
# no shifting needed
|
||||
operand = right.integer
|
||||
immediate = 1
|
||||
@ -75,7 +75,7 @@ module Arm
|
||||
operand = right.integer / 256
|
||||
immediate = 1
|
||||
|
||||
# raise "cannot fit numeric literal argument in operand #{right.inspect}"
|
||||
raise "cannot fit numeric literal argument in operand #{right.inspect}"
|
||||
end
|
||||
elsif (right.is_a?(Symbol) or right.is_a?(Virtual::Integer))
|
||||
operand = reg_code(right) #integer means the register the integer is in (otherwise constant)
|
||||
|
@ -1,9 +1,3 @@
|
||||
class Numeric
|
||||
def fits_u8?
|
||||
self >= 0 and self <= 255
|
||||
end
|
||||
end
|
||||
|
||||
module StreamReader
|
||||
def read_binary(size, count, type)
|
||||
d = __sr_read(size*count)
|
||||
|
@ -28,6 +28,9 @@ module Virtual
|
||||
def type
|
||||
Virtual::Integer
|
||||
end
|
||||
def fits_u8?
|
||||
integer >= 0 and integer <= 255
|
||||
end
|
||||
end
|
||||
|
||||
# The name really says it all.
|
||||
|
Loading…
x
Reference in New Issue
Block a user