class AdLint::Cc1::GreaterThanValueDomain

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 4723
def initialize(val, logical_shr)
  super(logical_shr)
  if val
    @value = val
  else
    raise ArgumentError, "greater than nil?"
  end
end

Public Instance Methods

!() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5347
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 5424
def !=(rhs_dom)
  rhs_dom._not_equal_greater_than(self)
end
&(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5168
def &(rhs_dom)
  rhs_dom.coerce_to_integer._and_greater_than(coerce_to_integer)
end
*(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5055
def *(rhs_dom)
  rhs_dom._mul_greater_than(self)
end
+(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5023
def +(rhs_dom)
  rhs_dom._add_greater_than(self)
end
+@() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5015
def +@
  self
end
-@() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5019
def -@
  ValueDomain.less_than(-@value, logical_shr?)
end
/(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5099
def /(rhs_dom)
  rhs_dom._div_greater_than(self)
end
<(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5355
def <(rhs_dom)
  rhs_dom._less_greater_than(self)
end
<<(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5275
def <<(rhs_dom)
  rhs_dom.coerce_to_integer._shl_greater_than(coerce_to_integer)
end
==(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5392
def ==(rhs_dom)
  rhs_dom._equal_greater_than(self)
end
>>(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5311
def >>(rhs_dom)
  rhs_dom.coerce_to_integer._shr_greater_than(coerce_to_integer)
end
^(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5236
def ^(rhs_dom)
  rhs_dom.coerce_to_integer._xor_greater_than(coerce_to_integer)
end
_add_equal_to(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5039
def _add_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes EqualToValueDomain#_add_greater_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 5051
def _add_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(lhs_dom.value + rhs_dom.value, logical_shr?)
end
_add_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5045
def _add_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes LessThanValueDomain#_add_greater_than.
  rhs_dom + lhs_dom
end
_add_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5027
def _add_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes NilValueDomain#_add_greater_than.
  rhs_dom + lhs_dom
end
_add_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5033
def _add_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes UnlimitedValueDomain#_add_greater_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 5184
def _and_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes EqualToValueDomain#_and_greater_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 5196
def _and_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.value > 0 && rhs_dom.value > 0
    ValueDomain.greater_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 5190
def _and_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes LessThanValueDomain#_and_greater_than.
  rhs_dom & lhs_dom
end
_and_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5172
def _and_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes NilValueDomain#_and_greater_than.
  rhs_dom & lhs_dom
end
_and_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5178
def _and_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes UnlimitedValueDomain#_and_greater_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 4762
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 4770
def _contain_greater_than?(lhs_dom, rhs_dom = self)
  lhs_dom.value <= rhs_dom.value
end
_contain_intersection?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4774
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 4766
def _contain_less_than?(lhs_dom, rhs_dom = self)
  false
end
_contain_nil?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4754
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 4778
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 4758
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 5119
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(
        lhs_dom.value / rhs_dom.value, logical_shr?
      ).intersection(ValueDomain.less_than(
        0, logical_shr?
      ))
    when lhs_dom.value == 0
      ValueDomain.equal_to(0, logical_shr?)
    when lhs_dom.value > 0
      ValueDomain.greater_than(
        0, logical_shr?
      ).intersection(ValueDomain.less_than(
        lhs_dom.value / rhs_dom.value, logical_shr?
      ))
    end
  end
end
_div_greater_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5155
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 5142
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 5103
def _div_nil(lhs_dom, rhs_dom = self)
  if rhs_dom.min_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 5111
def _div_unlimited(lhs_dom, rhs_dom = self)
  if rhs_dom.min_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 5408
def _equal_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes EqualToValueDomain#_equal_greater_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 5420
def _equal_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end
_equal_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5414
def _equal_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes LessThanValueDomain#_equal_greater_than.
  rhs_dom == lhs_dom
end
_equal_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5396
def _equal_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes NilValueDomain#_equal_greater_than.
  rhs_dom == lhs_dom
end
_equal_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5402
def _equal_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes UnlimitedValueDomain#_equal_greater_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 4799
def _intersect_equal_to?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes
  #       EqualToValueDomain#_intersect_greater_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 4813
def _intersect_greater_than?(lhs_dom, rhs_dom = self)
  true
end
_intersect_less_than?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4806
def _intersect_less_than?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes
  #       LessThanValueDomain#_intersect_greater_than?.
  rhs_dom.intersect?(lhs_dom)
end
_intersect_nil?(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4786
def _intersect_nil?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes NilValueDomain#_intersect_greater_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 4792
def _intersect_unlimited?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_intersect_greater_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 5548
def _intersection_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes
  #       EqualToValueDomain#_intersection_greater_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 5562
def _intersection_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.min_value
    rhs_dom
  else
    lhs_dom
  end
end
_intersection_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5555
def _intersection_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes
  #       LessThanValueDomain#_intersection_greater_than.
  rhs_dom.intersection(lhs_dom)
end
_intersection_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5535
def _intersection_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes NilValueDomain#_intersection_greater_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 5541
def _intersection_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_intersection_greater_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 5372
def _less_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value < rhs_dom.min_value
    ValueDomain.of_true(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 5388
def _less_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end
_less_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5380
def _less_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value < rhs_dom.min_value
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end
_less_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5359
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 5365
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 5473
def _logical_and_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes EqualToValueDomain#_logical_and_greater_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 5486
def _logical_and_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= 0 || rhs_dom.min_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 5479
def _logical_and_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes
  #       LessThanValueDomain#_logical_and_greater_than.
  rhs_dom.logical_and(lhs_dom)
end
_logical_and_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5460
def _logical_and_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes NilValueDomain#_logical_and_greater_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 5466
def _logical_and_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_logical_and_greater_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 5511
def _logical_or_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes EqualToValueDomain#_logical_or_greater_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 5523
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 5517
def _logical_or_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes LessThanValueDomain#_logical_or_greater_than.
  rhs_dom.logical_or(lhs_dom)
end
_logical_or_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5498
def _logical_or_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes NilValueDomain#_logical_or_greater_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 5504
def _logical_or_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_logical_or_greater_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 5071
def _mul_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes EqualToValueDomain#_mul_greater_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 5083
def _mul_greater_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_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5077
def _mul_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes LessThanValueDomain#_mul_greater_than.
  rhs_dom * lhs_dom
end
_mul_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5059
def _mul_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes NilValueDomain#_mul_greater_than.
  rhs_dom * lhs_dom
end
_mul_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5065
def _mul_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes UnlimitedValueDomain#_mul_greater_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 4817
def _narrow_by_eq(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_greater_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 4972
def _narrow_by_gt(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_greater_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 4919
def _narrow_by_lt(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_greater_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 4868
def _narrow_by_ne(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_greater_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 4832
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 4989
def _narrow_equal_to_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `------|------' by `> ------<======' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end
_narrow_equal_to_by_lt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4936
def _narrow_equal_to_by_lt(lhs_dom, rhs_dom = self)
  if lhs_dom.value >= rhs_dom.min_value
    # NOTE: Narrowing `---------|---' by `< ---<=========' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  else
    # NOTE: Narrowing `---|---------' by `< ---------<===' makes
    #       `---|---------'.
    lhs_dom
  end
end
_narrow_equal_to_by_ne(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4883
def _narrow_equal_to_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.value >= rhs_dom.min_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 4856
def _narrow_greater_than_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value >= rhs_dom.min_value
    # NOTE: Narrowing `---------<===' by `== ---<=========' makes
    #       `---------<==='.
    lhs_dom
  else
    # NOTE: Narrowing `---<=========' by `== ---------<===' makes
    #       `---------<==='.
    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 5001
def _narrow_greater_than_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `------<======' by `> ------<======' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end
_narrow_greater_than_by_lt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4960
def _narrow_greater_than_by_lt(lhs_dom, rhs_dom = self)
  if lhs_dom.value < rhs_dom.value
    # NOTE: Narrowing `---<=========' by `< ---------<===' makes
    #       `---<=====>---'.
    lhs_dom.intersect(rhs_dom.inversion)
  else
    # NOTE: Narrowing `---------<===' by `< ---<=========' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end
_narrow_greater_than_by_ne(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4907
def _narrow_greater_than_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value >= rhs_dom.min_value
    # NOTE: Narrowing `---------<===' by `!= ---<=========' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  else
    # NOTE: Narrowing `---<=========' by `!= ---------<===' makes
    #       `---<=====>---'.
    lhs_dom.intersection(rhs_dom.inversion)
  end
end
_narrow_less_than_by_eq(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4844
def _narrow_less_than_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.value > rhs_dom.value
    # NOTE: Narrowing `=========>---' by `== ---<=========' makes
    #       `---<=====>---'.
    lhs_dom.intersection(rhs_dom)
  else
    # NOTE: Narrowing `===>---------' by `== ---------<===' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end
_narrow_less_than_by_gt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4995
def _narrow_less_than_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `======>------' by `> ------<======' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end
_narrow_less_than_by_lt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4948
def _narrow_less_than_by_lt(lhs_dom, rhs_dom = self)
  if lhs_dom.value > rhs_dom.value
    # NOTE: Narrowing `=========>---' by `< ---<=========' makes
    #       `===>---------'.
    rhs_dom.inversion
  else
    # NOTE: Narrowing `===>---------' by `< ---------<===' makes
    #       `===>---------'.
    lhs_dom
  end
end
_narrow_less_than_by_ne(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4895
def _narrow_less_than_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= rhs_dom.min_value
    # NOTE: Narrowing `=========>---' by `!= ---<=========' makes
    #       `===>---------'.
    rhs_dom.inversion
  else
    # NOTE: Narrowing `===>---------' by `!= ---------<===' makes
    #       `===>---------'.
    lhs_dom
  end
end
_narrow_nil_by_eq(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4821
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 4976
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 4923
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 4872
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 4828
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 4983
def _narrow_unlimited_by_gt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `=============' by `> ------<======' makes
  #       `-------------'.
  ValueDomain.of_nil(logical_shr?)
end
_narrow_unlimited_by_lt(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4930
def _narrow_unlimited_by_lt(lhs_dom, rhs_dom = self)
  # NOTE: Narrowing `=============' by `< ------<======' makes
  #       `======>------'.
  rhs_dom.inversion
end
_narrow_unlimited_by_ne(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4879
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 5440
def _not_equal_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes EqualToValueDomain#_not_equal_greater_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 5452
def _not_equal_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.of_unlimited(logical_shr?)
end
_not_equal_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5446
def _not_equal_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes LessThanValueDomain#_not_equal_greater_than.
  rhs_dom != lhs_dom
end
_not_equal_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5428
def _not_equal_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes NilValueDomain#_not_equal_greater_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 5434
def _not_equal_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes UnlimitedValueDomain#_not_equal_greater_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 5220
def _or_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes EqualToValueDomain#_or_greater_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 5232
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 5226
def _or_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes LessThanValueDomain#_or_greater_than.
  rhs_dom | lhs_dom
end
_or_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5208
def _or_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes NilValueDomain#_or_greater_than.
  rhs_dom | lhs_dom
end
_or_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5214
def _or_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes UnlimitedValueDomain#_or_greater_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 5296
def _shl_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.greater_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 5306
def _shl_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_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 5301
def _shl_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_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 5279
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 5286
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 5332
def _shr_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.less_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 5342
def _shr_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.less_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 5337
def _shr_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.less_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 5315
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 5322
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 5586
def _union_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes EqualToValueDomain#_union_greater_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 5598
def _union_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.min_value
    lhs_dom
  else
    rhs_dom
  end
end
_union_less_than(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5592
def _union_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes LessThanValueDomain#_union_greater_than.
  rhs_dom.union(lhs_dom)
end
_union_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5574
def _union_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes NilValueDomain#_union_greater_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 5580
def _union_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes UnlimitedValueDomain#_union_greater_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 5252
def _xor_equal_to(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes EqualToValueDomain#_xor_greater_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 5264
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 5258
def _xor_less_than(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes LessThanValueDomain#_xor_greater_than.
  rhs_dom ^ lhs_dom
end
_xor_nil(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5240
def _xor_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes NilValueDomain#_xor_greater_than.
  rhs_dom ^ lhs_dom
end
_xor_unlimited(lhs_dom, rhs_dom = self) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5246
def _xor_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes UnlimitedValueDomain#_xor_greater_than.
  rhs_dom ^ lhs_dom
end
ambiguous?() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4746
def ambiguous?
  false
end
coerce_to_integer() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5606
def coerce_to_integer
  if @value.integer?
    self
  else
    ValueDomain.greater_than(@value.to_i, logical_shr?)
  end
end
coerce_to_real() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5614
def coerce_to_real
  if @value.real?
    self
  else
    ValueDomain.greater_than(@value.to_f, logical_shr?)
  end
end
complexity() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5652
def complexity
  1
end
contain_value_domain?(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4750
def contain_value_domain?(rhs_dom)
  rhs_dom._contain_greater_than?(self)
end
each_sample() { |min_value| ... } click to toggle source
# File lib/adlint/cc1/domain.rb, line 5634
def each_sample
  if block_given?
    yield(min_value)
    self
  else
    to_enum(:each_sample)
  end
end
empty?() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4734
def empty?
  false
end
intersect?(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 4782
def intersect?(rhs_dom)
  rhs_dom._intersect_greater_than?(self)
end
intersection(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5531
def intersection(rhs_dom)
  rhs_dom._intersection_greater_than(self)
end
inversion() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5007
def inversion
  ValueDomain.less_than_or_equal_to(@value, logical_shr?)
end
logical_and(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5456
def logical_and(rhs_dom)
  rhs_dom._logical_and_greater_than(self)
end
logical_or(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5494
def logical_or(rhs_dom)
  rhs_dom._logical_or_greater_than(self)
end
max_value() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5630
def max_value
  nil
end
min_value() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5622
def min_value
  if @value.integer?
    @value + 1
  else
    @value + Float::EPSILON
  end
end
nan?() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4738
def nan?
  false
end
to_defined_domain() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5643
def to_defined_domain
  self
end
to_s() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5647
def to_s
  "(> #{@value})"
end
undefined?() click to toggle source
# File lib/adlint/cc1/domain.rb, line 4742
def undefined?
  false
end
union(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5570
def union(rhs_dom)
  rhs_dom._union_greater_than(self)
end
|(rhs_dom) click to toggle source
# File lib/adlint/cc1/domain.rb, line 5204
def |(rhs_dom)
  rhs_dom.coerce_to_integer._or_greater_than(coerce_to_integer)
end
~() click to toggle source
# File lib/adlint/cc1/domain.rb, line 5011
def ~
  ValueDomain.greater_than(~coerce_to_integer.value, logical_shr?)
end