class AdLint::Cc1::LessThanValueDomain

Attributes

value[R]

Public Class Methods

new(val, logical_shr) click to toggle source
Calls superclass method AdLint::Cc1::ValueDomain::new
# File lib/adlint/cc1/domain.rb, line 3777
def initialize(val, logical_shr)
  super(logical_shr)
  if val
    @value = val
  else
    raise ArgumentError, "less than nil?"
  end
end

Public Instance Methods

!() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4403
def !
  if @value < 0
    ValueDomain.of_false(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end
!=(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4482
def !=(rhs_dom)
  rhs_dom._not_equal_less_than(self)
end
&(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4219
def &(rhs_dom)
  rhs_dom.coerce_to_integer._and_less_than(coerce_to_integer)
end
*(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4101
def *(rhs_dom)
  rhs_dom._mul_less_than(self)
end
+(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4071
def +(rhs_dom)
  rhs_dom._add_less_than(self)
end
+@() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4063
def +@
  self
end
-@() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4067
def -@
  ValueDomain.greater_than(-@value, logical_shr?)
end
/(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4155
def /(rhs_dom)
  rhs_dom._div_less_than(self)
end
<(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4411
def <(rhs_dom)
  rhs_dom._less_less_than(self)
end
<<(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4331
def <<(rhs_dom)
  rhs_dom.coerce_to_integer._shl_less_than(coerce_to_integer)
end
==(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4448
def ==(rhs_dom)
  rhs_dom._equal_less_than(self)
end
>>(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4367
def >>(rhs_dom)
  rhs_dom.coerce_to_integer._shr_less_than(coerce_to_integer)
end
^(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4287
def ^(rhs_dom)
  rhs_dom.coerce_to_integer._xor_less_than(coerce_to_integer)
end
_add_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4087
def _add_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes EqualToValueDomain#_add_less_than.
  rhs_dom + lhs_dom
end
_add_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4097
def _add_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end
_add_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4093
def _add_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(lhs_dom.value + rhs_dom.value, logical_shr?)
end
_add_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4075
def _add_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes NilValueDomain#_add_less_than.
  rhs_dom + lhs_dom
end
_add_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4081
def _add_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes UnlimitedValueDomain#_add_less_than.
  rhs_dom + lhs_dom
end
_and_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4235
def _and_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes EqualToValueDomain#_and_less_than.
  rhs_dom & lhs_dom
end
_and_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4249
def _and_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value > 0 && rhs_dom.value < 0
    ValueDomain.less_than(lhs_dom.value & rhs_dom.value, logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end
_and_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4241
def _and_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value < 0 && rhs_dom.value < 0
    ValueDomain.less_than(lhs_dom.value & rhs_dom.value, logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end
_and_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4223
def _and_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes NilValueDomain#_and_less_than.
  rhs_dom & lhs_dom
end
_and_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4229
def _and_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes UnlimitedValueDomain#_and_less_than.
  rhs_dom & lhs_dom
end
_contain_equal_to?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3816
def _contain_equal_to?(lhs_dom, rhs_dom = self)
  false
end
_contain_greater_than?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3824
def _contain_greater_than?(lhs_dom, rhs_dom = self)
  false
end
_contain_intersection?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3828
def _contain_intersection?(lhs_dom, rhs_dom = self)
  lhs_dom.domain_pair.all? { |lhs| lhs.contain_value_domain?(rhs_dom) }
end
_contain_less_than?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3820
def _contain_less_than?(lhs_dom, rhs_dom = self)
  lhs_dom.value >= rhs_dom.value
end
_contain_nil?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3808
def _contain_nil?(lhs_dom, rhs_dom = self)
  false
end
_contain_union?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3832
def _contain_union?(lhs_dom, rhs_dom = self)
  lhs_dom.domain_pair.any? { |lhs| lhs.contain_value_domain?(rhs_dom) }
end
_contain_unlimited?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3812
def _contain_unlimited?(lhs_dom, rhs_dom = self)
  true
end
_div_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4175
def _div_equal_to(lhs_dom, rhs_dom = self)
  if rhs_dom.value >= 0
    ValueDomain.of_nan(logical_shr?)
  else
    case
    when lhs_dom.value < 0
      ValueDomain.greater_than(0, logical_shr?).intersection(
        ValueDomain.less_than(lhs_dom.value / rhs_dom.value, logical_shr?))
    when lhs_dom.value == 0
      ValueDomain.equal_to(0, logical_shr?)
    when lhs_dom.value > 0
      ValueDomain.greater_than(
        lhs_dom.value / rhs_dom.value, logical_shr?
      ).intersection(ValueDomain.less_than(0, logical_shr?))
    end
  end
end
_div_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4206
def _div_greater_than(lhs_dom, rhs_dom = self)
  if rhs_dom.value > 0
    ValueDomain.of_nan(logical_shr?)
  else
    case
    when lhs_dom.value >= 0
      ValueDomain.less_than(0, logical_shr?)
    when lhs_dom.value < 0
      ValueDomain.greater_than(0, logical_shr?)
    end
  end
end
_div_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4193
def _div_less_than(lhs_dom, rhs_dom = self)
  if rhs_dom.value > 0
    ValueDomain.of_nan(logical_shr?)
  else
    case
    when lhs_dom.value <= 0
      ValueDomain.greater_than(0, logical_shr?)
    when lhs_dom.value > 0
      ValueDomain.less_than(0, logical_shr?)
    end
  end
end
_div_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4159
def _div_nil(lhs_dom, rhs_dom = self)
  if rhs_dom.max_value >= 0
    ValueDomain.of_nan(logical_shr?)
  else
    lhs_dom
  end
end
_div_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4167
def _div_unlimited(lhs_dom, rhs_dom = self)
  if rhs_dom.max_value >= 0
    ValueDomain.of_nan(logical_shr?)
  else
    lhs_dom
  end
end
_equal_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4464
def _equal_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes EqualToValueDomain#_equal_less_than.
  rhs_dom == lhs_dom
end
_equal_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4474
def _equal_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.max_value
    ValueDomain.of_unlimited(logical_shr?)
  else
    ValueDomain.of_false(logical_shr?)
  end
end
_equal_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4470
def _equal_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end
_equal_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4452
def _equal_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes NilValueDomain#_equal_less_than.
  rhs_dom == lhs_dom
end
_equal_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4458
def _equal_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes UnlimitedValueDomain#_equal_less_than.
  rhs_dom == lhs_dom
end
_intersect_equal_to?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3853
def _intersect_equal_to?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes EqualToValueDomain#_intersect_less_than?.
  rhs_dom.intersect?(lhs_dom)
end
_intersect_greater_than?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3863
def _intersect_greater_than?(lhs_dom, rhs_dom = self)
  lhs_dom.min_value <= rhs_dom.max_value
end
_intersect_less_than?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3859
def _intersect_less_than?(lhs_dom, rhs_dom = self)
  true
end
_intersect_nil?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3840
def _intersect_nil?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes NilValueDomain#_intersect_less_than?.
  rhs_dom.intersect?(lhs_dom)
end
_intersect_unlimited?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3846
def _intersect_unlimited?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_intersect_less_than?.
  rhs_dom.intersect?(lhs_dom)
end
_intersection_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4608
def _intersection_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes EqualToValueDomain#_intersection_less_than.
  rhs_dom.intersection(lhs_dom)
end
_intersection_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4622
def _intersection_greater_than(lhs_dom, rhs_dom = self)
  case
  when lhs_dom.min_value < rhs_dom.max_value
    ValueDomain._create_intersection(lhs_dom, rhs_dom)
  when lhs_dom.min_value == rhs_dom.max_value
    ValueDomain.equal_to(lhs_dom.min_value, logical_shr?)
  when lhs_dom.min_value > rhs_dom.max_value
    ValueDomain.of_nil(logical_shr?)
  end
end
_intersection_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4614
def _intersection_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value <= rhs_dom.max_value
    lhs_dom
  else
    rhs_dom
  end
end
_intersection_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4596
def _intersection_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes NilValueDomain#_intersection_less_than.
  rhs_dom.intersection(lhs_dom)
end
_intersection_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4602
def _intersection_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes UnlimitedValueDomain#_intersection_less_than.
  rhs_dom.intersection(lhs_dom)
end
_less_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4428
def _less_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value >= rhs_dom.max_value
    ValueDomain.of_false(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end
_less_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4440
def _less_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value >= rhs_dom.max_value
    ValueDomain.of_false(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end
_less_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4436
def _less_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end
_less_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4415
def _less_nil(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, any comparison with NilValueDomain makes no sense.
  ValueDomain.of_nil(logical_shr?)
end
_less_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4421
def _less_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: UnlimitedValueDomain contains everything.
  #       So, any comparison with UnlimitedValueDomain makes
  #       UnlimitedValueDomain.
  ValueDomain.of_unlimited(logical_shr?)
end
_logical_and_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4532
def _logical_and_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes EqualToValueDomain#_logical_and_less_than.
  rhs_dom.logical_and(lhs_dom)
end
_logical_and_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4546
def _logical_and_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= 0 || rhs_dom.max_value >= 0
    ValueDomain.of_unlimited(logical_shr?)
  else
    ValueDomain.of_true(logical_shr?)
  end
end
_logical_and_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4538
def _logical_and_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= 0 || rhs_dom.max_value >= 0
    ValueDomain.of_unlimited(logical_shr?)
  else
    ValueDomain.of_true(logical_shr?)
  end
end
_logical_and_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4520
def _logical_and_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes NilValueDomain#_logical_and_less_than.
  rhs_dom.logical_and(lhs_dom)
end
_logical_and_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4526
def _logical_and_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes UnlimitedValueDomain#_logical_and_less_than.
  rhs_dom.logical_and(lhs_dom)
end
_logical_or_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4570
def _logical_or_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes EqualToValueDomain#_logical_or_less_than.
  rhs_dom.logical_or(lhs_dom)
end
_logical_or_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4584
def _logical_or_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value > 0 || rhs_dom.value < 0
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end
_logical_or_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4576
def _logical_or_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value < 0 || rhs_dom.value < 0
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end
_logical_or_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4558
def _logical_or_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes NilValueDomain#_logical_or_less_than.
  rhs_dom.logical_or(lhs_dom)
end
_logical_or_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4564
def _logical_or_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes UnlimitedValueDomain#_logical_or_less_than.
  rhs_dom.logical_or(lhs_dom)
end
_mul_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4117
def _mul_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes EqualToValueDomain#_mul_less_than.
  rhs_dom * lhs_dom
end
_mul_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4139
def _mul_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value >= 0
    if rhs_dom.value <= 0
      ValueDomain.less_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  else
    if rhs_dom.value <= 0
      ValueDomain.of_unlimited(logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  end
end
_mul_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4123
def _mul_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value <= 0
    if rhs_dom.value <= 0
      ValueDomain.greater_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  else
    if rhs_dom.value <= 0
      ValueDomain.of_unlimited(logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  end
end
_mul_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4105
def _mul_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes NilValueDomain#_mul_less_than.
  rhs_dom * lhs_dom
end
_mul_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4111
def _mul_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes UnlimitedValueDomain#_mul_less_than.
  rhs_dom * lhs_dom
end
_narrow_by_eq(rhs_dom, lhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3867
def _narrow_by_eq(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_less_than_by_eq(lhs_dom)
end
_narrow_by_gt(rhs_dom, lhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4002
def _narrow_by_gt(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_less_than_by_gt(lhs_dom)
end
_narrow_by_lt(rhs_dom, lhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3967
def _narrow_by_lt(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_less_than_by_lt(lhs_dom)
end
_narrow_by_ne(rhs_dom, lhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3916
def _narrow_by_ne(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_less_than_by_ne(lhs_dom)
end
_narrow_equal_to_by_eq(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3882
def _narrow_equal_to_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.value < rhs_dom.value
    # NOTE: Narrowing `------|------' by `== =========>---' makes
    #       `------|------'.
    lhs_dom
  else
    # NOTE: Narrowing `---------|---' by `== ===>---------' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end
_narrow_equal_to_by_gt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4019
def _narrow_equal_to_by_gt(lhs_dom, rhs_dom = self)
  if lhs_dom.value > rhs_dom.max_value
    # NOTE: Narrowing `---------|---' by `> ===>---------' makes
    #       `---------|---'.
    lhs_dom
  else
    # NOTE: Narrowing `---|---------' by `> =========>---' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end
_narrow_equal_to_by_lt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3984
def _narrow_equal_to_by_lt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `------|------' by `< ======>------' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end
_narrow_equal_to_by_ne(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3931
def _narrow_equal_to_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.value <= rhs_dom.max_value
    # NOTE: Narrowing `---|---------' by `!= =========>---' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  else
    # NOTE: Narrowing `---------|---' by `!= ===>---------' makes
    #       `---------|---'.
    lhs_dom
  end
end
_narrow_greater_than_by_eq(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3906
def _narrow_greater_than_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value > rhs_dom.max_value
    ValueDomain.of_nil(logical_shr?)
  else
    # NOTE: Narrowing `---<=========' by `== =========>---' makes
    #       `---<=====>---'.
    lhs_dom.intersection(rhs_dom)
  end
end
_narrow_greater_than_by_gt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4043
def _narrow_greater_than_by_gt(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value < rhs_dom.max_value
    # NOTE: Narrowing `---<=========' by `> =========>---' makes
    #       `---------<==='.
    rhs_dom.inversion
  else
    # NOTE: Narrowing `---------<===' by `> ===>---------' makes
    #       `---------<==='.
    lhs_dom
  end
end
_narrow_greater_than_by_lt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3996
def _narrow_greater_than_by_lt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `---<=========' by `< =========>---' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end
_narrow_greater_than_by_ne(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3955
def _narrow_greater_than_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.max_value
    # NOTE: Narrowing `---<=========' by `!= =========>---' makes
    #       `---------<==='.
    rhs_dom.inversion
  else
    # NOTE: Narrowing `---------<===' by `!= ===>---------' makes
    #       `---------<==='.
    lhs_dom
  end
end
_narrow_less_than_by_eq(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3894
def _narrow_less_than_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.value < rhs_dom.value
    # NOTE: Narrowing `===>---------' by `== =========>---' makes
    #       `===>---------'.
    lhs_dom
  else
    # NOTE: Narrowing `=========>---' by `== ===>---------' makes
    #       `===>---------'.
    rhs_dom
  end
end
_narrow_less_than_by_gt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4031
def _narrow_less_than_by_gt(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value > rhs_dom.max_value
    # NOTE: Narrowing `=========>---' by `> ===>---------' makes
    #       `---<=====>---'.
    rhs_dom.inversion.intersection(lhs_dom)
  else
    # NOTE: Narrowing `===>---------' by `> =========>---' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end
_narrow_less_than_by_lt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3990
def _narrow_less_than_by_lt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `=========>---' by `< =======>-----' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end
_narrow_less_than_by_ne(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3943
def _narrow_less_than_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value <= rhs_dom.max_value
    # NOTE: Narrowing `===>---------' by `!= =========>---' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  else
    # NOTE: Narrowing `=========>---' by `!= ===>---------' makes
    #       `---<=====>---'.
    lhs_dom.intersection(rhs_dom.inversion)
  end
end
_narrow_nil_by_eq(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3871
def _narrow_nil_by_eq(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, narrowing NilValueDomain by anything makes no effect to the
  #       target value-domain.
  lhs_dom
end
_narrow_nil_by_gt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4006
def _narrow_nil_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, narrowing NilValueDomain by anything makes no effect to the
  #       target value-domain.
  lhs_dom
end
_narrow_nil_by_lt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3971
def _narrow_nil_by_lt(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, narrowing NilValueDomain by anything makes no effect to the
  #       target value-domain.
  lhs_dom
end
_narrow_nil_by_ne(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3920
def _narrow_nil_by_ne(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, narrowing NilValueDomain by anything makes no effect to the
  #       target value-domain.
  lhs_dom
end
_narrow_unlimited_by_eq(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3878
def _narrow_unlimited_by_eq(lhs_dom, rhs_dom = self)
  rhs_dom
end
_narrow_unlimited_by_gt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4013
def _narrow_unlimited_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `=============' by `> ======>------' makes
  #       `------<======'.
  rhs_dom.inversion
end
_narrow_unlimited_by_lt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3978
def _narrow_unlimited_by_lt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `=============' by `< ======>------' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end
_narrow_unlimited_by_ne(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3927
def _narrow_unlimited_by_ne(lhs_dom, rhs_dom = self)
  rhs_dom.inversion
end
_not_equal_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4498
def _not_equal_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes EqualToValueDomain#_not_equal_less_than.
  rhs_dom != lhs_dom
end
_not_equal_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4508
def _not_equal_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.max_value
    ValueDomain.of_unlimited(logical_shr?)
  else
    ValueDomain.of_true(logical_shr?)
  end
end
_not_equal_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4504
def _not_equal_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end
_not_equal_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4486
def _not_equal_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes NilValueDomain#_not_equal_less_than.
  rhs_dom != lhs_dom
end
_not_equal_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4492
def _not_equal_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes UnlimitedValueDomain#_not_equal_less_than.
  rhs_dom != lhs_dom
end
_or_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4273
def _or_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes EqualToValueDomain#_or_less_than.
  rhs_dom | lhs_dom
end
_or_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4283
def _or_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end
_or_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4279
def _or_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(lhs_dom.value | rhs_dom.value, logical_shr?)
end
_or_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4261
def _or_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes NilValueDomain#_or_less_than.
  rhs_dom | lhs_dom
end
_or_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4267
def _or_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes UnlimitedValueDomain#_or_less_than.
  rhs_dom | lhs_dom
end
_shl_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4352
def _shl_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(left_shift(lhs_dom.value, rhs_dom.value),
                        logical_shr?)
end
_shl_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4362
def _shl_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(left_shift(lhs_dom.value, rhs_dom.value),
                        logical_shr?)
end
_shl_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4357
def _shl_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(left_shift(lhs_dom.value, rhs_dom.value),
                        logical_shr?)
end
_shl_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4335
def _shl_nil(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, any arithmetic operation with NilValueDomain makes
  #       NilValueDomain.
  lhs_dom
end
_shl_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4342
def _shl_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: UnlimitedValueDomain contains everything.
  #       So, this arithmetic operation with UnlimitedValueDomain makes
  #       UnlimitedValueDomain because of the bit-overflow.
  # NOTE: NaN is a subclass of UnlimitedValueDomain.
  #       Arithmetic operation with UnlimitedValueDomain should make
  #       UnlimitedValueDomain, and with NaN should make NaN.
  lhs_dom
end
_shr_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4388
def _shr_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(right_shift(lhs_dom.value, rhs_dom.value),
                           logical_shr?)
end
_shr_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4398
def _shr_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(right_shift(lhs_dom.value, rhs_dom.value),
                           logical_shr?)
end
_shr_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4393
def _shr_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(right_shift(lhs_dom.value, rhs_dom.value),
                           logical_shr?)
end
_shr_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4371
def _shr_nil(lhs_dom, rhs_dom = self)
  # NOTE: NilValueDomain contains no values.
  #       So, any arithmetic operation with NilValueDomain makes
  #       NilValueDomain.
  lhs_dom
end
_shr_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4378
def _shr_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: UnlimitedValueDomain contains everything.
  #       So, this arithmetic operation with UnlimitedValueDomain makes
  #       UnlimitedValueDomain because of the bit-overflow.
  # NOTE: NaN is a subclass of UnlimitedValueDomain.
  #       Arithmetic operation with UnlimitedValueDomain should make
  #       UnlimitedValueDomain, and with NaN should make NaN.
  lhs_dom
end
_union_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4649
def _union_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes EqualToValueDomain#_union_less_than.
  rhs_dom.union(lhs_dom)
end
_union_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4663
def _union_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.max_value
    ValueDomain.of_unlimited(logical_shr?)
  else
    ValueDomain._create_union(lhs_dom, rhs_dom)
  end
end
_union_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4655
def _union_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value <= rhs_dom.max_value
    rhs_dom
  else
    lhs_dom
  end
end
_union_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4637
def _union_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes NilValueDomain#_union_less_than.
  rhs_dom.union(lhs_dom)
end
_union_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4643
def _union_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes UnlimitedValueDomain#_union_less_than.
  rhs_dom.union(lhs_dom)
end
_xor_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4303
def _xor_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes EqualToValueDomain#_xor_less_than.
  rhs_dom ^ lhs_dom
end
_xor_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4320
def _xor_greater_than(lhs_dom, rhs_dom = self)
  case
  when lhs_dom.value < 0 && rhs_dom.value < 0
    ValueDomain.greater_than(0, logical_shr?)
  when lhs_dom.value < 0 || rhs_dom.value < 0
    ValueDomain.less_than(0, logical_shr?)
  else
    ValueDomain.greater_than(0, logical_shr?)
  end
end
_xor_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4309
def _xor_less_than(lhs_dom, rhs_dom = self)
  case
  when lhs_dom.value < 0 && rhs_dom.value < 0
    ValueDomain.greater_than(0, logical_shr?)
  when lhs_dom.value < 0 || rhs_dom.value < 0
    ValueDomain.less_than(0, logical_shr?)
  else
    ValueDomain.greater_than(0, logical_shr?)
  end
end
_xor_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4291
def _xor_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes NilValueDomain#_xor_less_than.
  rhs_dom ^ lhs_dom
end
_xor_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4297
def _xor_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes UnlimitedValueDomain#_xor_less_than.
  rhs_dom ^ lhs_dom
end
ambiguous?() click to toggle source
# File lib/adlint/cc1/domain.rb, line 3800
def ambiguous?
  false
end
coerce_to_integer() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4671
def coerce_to_integer
  if @value.integer?
    self
  else
    ValueDomain.less_than(@value.to_i, logical_shr?)
  end
end
coerce_to_real() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4679
def coerce_to_real
  if @value.real?
    self
  else
    ValueDomain.less_than(@value.to_f, logical_shr?)
  end
end
complexity() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4717
def complexity
  1
end
contain_value_domain?(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3804
def contain_value_domain?(rhs_dom)
  rhs_dom._contain_less_than?(self)
end
each_sample() { |max_value| ... } click to toggle source
# File lib/adlint/cc1/domain.rb, line 4699
def each_sample
  if block_given?
    yield(max_value)
    self
  else
    to_enum(:each_sample)
  end
end
empty?() click to toggle source
# File lib/adlint/cc1/domain.rb, line 3788
def empty?
  false
end
intersect?(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 3836
def intersect?(rhs_dom)
  rhs_dom._intersect_less_than?(self)
end
intersection(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4592
def intersection(rhs_dom)
  rhs_dom._intersection_less_than(self)
end
inversion() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4055
def inversion
  ValueDomain.greater_than_or_equal_to(@value, logical_shr?)
end
logical_and(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4516
def logical_and(rhs_dom)
  rhs_dom._logical_and_less_than(self)
end
logical_or(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4554
def logical_or(rhs_dom)
  rhs_dom._logical_or_less_than(self)
end
max_value() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4691
def max_value
  if @value.integer?
    @value - 1
  else
    @value - Float::EPSILON
  end
end
min_value() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4687
def min_value
  nil
end
nan?() click to toggle source
# File lib/adlint/cc1/domain.rb, line 3792
def nan?
  false
end
to_defined_domain() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4708
def to_defined_domain
  self
end
to_s() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4712
def to_s
  "(< #{@value})"
end
undefined?() click to toggle source
# File lib/adlint/cc1/domain.rb, line 3796
def undefined?
  false
end
union(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4633
def union(rhs_dom)
  rhs_dom._union_less_than(self)
end
|(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4257
def |(rhs_dom)
  rhs_dom.coerce_to_integer._or_less_than(coerce_to_integer)
end
~() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4059
def ~
  ValueDomain.less_than(~coerce_to_integer.value, logical_shr?)
end