Class: AdLint::Cc1::LessThanValueDomain

Inherits:
ValueDomain show all
Defined in:
lib/adlint/cc1/domain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ValueDomain

#%, #-, #<=, #<=>, #>, #>=, #_narrow_by_ge, #_narrow_by_le, #_widen_by_eq, #_widen_by_ge, #_widen_by_gt, #_widen_by_le, #_widen_by_lt, #_widen_by_ne, #contain?, #eql?, #hash, #logical_shr?, #narrow, #widen

Methods included from ValueDomainFactory

#_create_intersection, #_create_union, #clear_memos, #equal_to, #greater_than, #greater_than_or_equal_to, #less_than, #less_than_or_equal_to, #not_equal_to, #of_ambiguous, #of_false, #of_intersection, #of_nan, #of_nil, #of_true, #of_undefined, #of_union, #of_unlimited

Constructor Details

#initialize(val, logical_shr) ⇒ LessThanValueDomain

Returns a new instance of LessThanValueDomain.



3777
3778
3779
3780
3781
3782
3783
3784
# 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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



3786
3787
3788
# File 'lib/adlint/cc1/domain.rb', line 3786

def value
  @value
end

Instance Method Details

#!Object



4403
4404
4405
4406
4407
4408
4409
# 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) ⇒ Object



4482
4483
4484
# File 'lib/adlint/cc1/domain.rb', line 4482

def !=(rhs_dom)
  rhs_dom._not_equal_less_than(self)
end

#&(rhs_dom) ⇒ Object



4219
4220
4221
# 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) ⇒ Object



4101
4102
4103
# File 'lib/adlint/cc1/domain.rb', line 4101

def *(rhs_dom)
  rhs_dom._mul_less_than(self)
end

#+(rhs_dom) ⇒ Object



4071
4072
4073
# File 'lib/adlint/cc1/domain.rb', line 4071

def +(rhs_dom)
  rhs_dom._add_less_than(self)
end

#+@Object



4063
4064
4065
# File 'lib/adlint/cc1/domain.rb', line 4063

def +@
  self
end

#-@Object



4067
4068
4069
# File 'lib/adlint/cc1/domain.rb', line 4067

def -@
  ValueDomain.greater_than(-@value, logical_shr?)
end

#/(rhs_dom) ⇒ Object



4155
4156
4157
# File 'lib/adlint/cc1/domain.rb', line 4155

def /(rhs_dom)
  rhs_dom._div_less_than(self)
end

#<(rhs_dom) ⇒ Object



4411
4412
4413
# File 'lib/adlint/cc1/domain.rb', line 4411

def <(rhs_dom)
  rhs_dom._less_less_than(self)
end

#<<(rhs_dom) ⇒ Object



4331
4332
4333
# 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) ⇒ Object



4448
4449
4450
# File 'lib/adlint/cc1/domain.rb', line 4448

def ==(rhs_dom)
  rhs_dom._equal_less_than(self)
end

#>>(rhs_dom) ⇒ Object



4367
4368
4369
# 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) ⇒ Object



4287
4288
4289
# 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) ⇒ Object



4087
4088
4089
4090
4091
# 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) ⇒ Object



4097
4098
4099
# 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) ⇒ Object



4093
4094
4095
# 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) ⇒ Object



4075
4076
4077
4078
4079
# 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) ⇒ Object



4081
4082
4083
4084
4085
# 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) ⇒ Object



4235
4236
4237
4238
4239
# 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) ⇒ Object



4249
4250
4251
4252
4253
4254
4255
# 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) ⇒ Object



4241
4242
4243
4244
4245
4246
4247
# 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) ⇒ Object



4223
4224
4225
4226
4227
# 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) ⇒ Object



4229
4230
4231
4232
4233
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3816
3817
3818
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3824
3825
3826
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3828
3829
3830
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3820
3821
3822
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3808
3809
3810
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3832
3833
3834
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3812
3813
3814
# 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) ⇒ Object



4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
# 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) ⇒ Object



4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
# 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) ⇒ Object



4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
# 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) ⇒ Object



4159
4160
4161
4162
4163
4164
4165
# 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) ⇒ Object



4167
4168
4169
4170
4171
4172
4173
# 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) ⇒ Object



4464
4465
4466
4467
4468
# 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) ⇒ Object



4474
4475
4476
4477
4478
4479
4480
# 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) ⇒ Object



4470
4471
4472
# 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) ⇒ Object



4452
4453
4454
4455
4456
# 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) ⇒ Object



4458
4459
4460
4461
4462
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3853
3854
3855
3856
3857
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3863
3864
3865
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3859
3860
3861
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3840
3841
3842
3843
3844
# 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) ⇒ Boolean

Returns:

  • (Boolean)


3846
3847
3848
3849
3850
3851
# 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) ⇒ Object



4608
4609
4610
4611
4612
# 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) ⇒ Object



4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
# 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) ⇒ Object



4614
4615
4616
4617
4618
4619
4620
# 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) ⇒ Object



4596
4597
4598
4599
4600
# 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) ⇒ Object



4602
4603
4604
4605
4606
# 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) ⇒ Object



4428
4429
4430
4431
4432
4433
4434
# 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) ⇒ Object



4440
4441
4442
4443
4444
4445
4446
# 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) ⇒ Object



4436
4437
4438
# 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) ⇒ Object



4415
4416
4417
4418
4419
# 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) ⇒ Object



4421
4422
4423
4424
4425
4426
# 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) ⇒ Object



4532
4533
4534
4535
4536
# 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) ⇒ Object



4546
4547
4548
4549
4550
4551
4552
# 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) ⇒ Object



4538
4539
4540
4541
4542
4543
4544
# 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) ⇒ Object



4520
4521
4522
4523
4524
# 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) ⇒ Object



4526
4527
4528
4529
4530
# 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) ⇒ Object



4570
4571
4572
4573
4574
# 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) ⇒ Object



4584
4585
4586
4587
4588
4589
4590
# 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) ⇒ Object



4576
4577
4578
4579
4580
4581
4582
# 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) ⇒ Object



4558
4559
4560
4561
4562
# 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) ⇒ Object



4564
4565
4566
4567
4568
# 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) ⇒ Object



4117
4118
4119
4120
4121
# 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) ⇒ Object



4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
# 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) ⇒ Object



4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
# 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) ⇒ Object



4105
4106
4107
4108
4109
# 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) ⇒ Object



4111
4112
4113
4114
4115
# 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) ⇒ Object



3867
3868
3869
# 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) ⇒ Object



4002
4003
4004
# 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) ⇒ Object



3967
3968
3969
# 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) ⇒ Object



3916
3917
3918
# 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) ⇒ Object



3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
# 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) ⇒ Object



4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
# 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) ⇒ Object



3984
3985
3986
3987
3988
# 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) ⇒ Object



3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
# 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) ⇒ Object



3906
3907
3908
3909
3910
3911
3912
3913
3914
# 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) ⇒ Object



4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
# 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) ⇒ Object



3996
3997
3998
3999
4000
# 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) ⇒ Object



3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
# 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) ⇒ Object



3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
# 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) ⇒ Object



4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
# 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) ⇒ Object



3990
3991
3992
3993
3994
# 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) ⇒ Object



3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
# 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) ⇒ Object



3871
3872
3873
3874
3875
3876
# 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) ⇒ Object



4006
4007
4008
4009
4010
4011
# 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) ⇒ Object



3971
3972
3973
3974
3975
3976
# 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) ⇒ Object



3920
3921
3922
3923
3924
3925
# 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) ⇒ Object



3878
3879
3880
# 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) ⇒ Object



4013
4014
4015
4016
4017
# 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) ⇒ Object



3978
3979
3980
3981
3982
# 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) ⇒ Object



3927
3928
3929
# 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) ⇒ Object



4498
4499
4500
4501
4502
# 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) ⇒ Object



4508
4509
4510
4511
4512
4513
4514
# 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) ⇒ Object



4504
4505
4506
# 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) ⇒ Object



4486
4487
4488
4489
4490
# 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) ⇒ Object



4492
4493
4494
4495
4496
# 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) ⇒ Object



4273
4274
4275
4276
4277
# 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) ⇒ Object



4283
4284
4285
# 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) ⇒ Object



4279
4280
4281
# 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) ⇒ Object



4261
4262
4263
4264
4265
# 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) ⇒ Object



4267
4268
4269
4270
4271
# 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) ⇒ Object



4352
4353
4354
4355
# 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) ⇒ Object



4362
4363
4364
4365
# 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) ⇒ Object



4357
4358
4359
4360
# 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) ⇒ Object



4335
4336
4337
4338
4339
4340
# 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) ⇒ Object



4342
4343
4344
4345
4346
4347
4348
4349
4350
# 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) ⇒ Object



4388
4389
4390
4391
# 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) ⇒ Object



4398
4399
4400
4401
# 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) ⇒ Object



4393
4394
4395
4396
# 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) ⇒ Object



4371
4372
4373
4374
4375
4376
# 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) ⇒ Object



4378
4379
4380
4381
4382
4383
4384
4385
4386
# 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) ⇒ Object



4649
4650
4651
4652
4653
# 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) ⇒ Object



4663
4664
4665
4666
4667
4668
4669
# 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) ⇒ Object



4655
4656
4657
4658
4659
4660
4661
# 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) ⇒ Object



4637
4638
4639
4640
4641
# 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) ⇒ Object



4643
4644
4645
4646
4647
# 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) ⇒ Object



4303
4304
4305
4306
4307
# 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) ⇒ Object



4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
# 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) ⇒ Object



4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
# 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) ⇒ Object



4291
4292
4293
4294
4295
# 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) ⇒ Object



4297
4298
4299
4300
4301
# 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?Boolean

Returns:

  • (Boolean)


3800
3801
3802
# File 'lib/adlint/cc1/domain.rb', line 3800

def ambiguous?
  false
end

#coerce_to_integerObject



4671
4672
4673
4674
4675
4676
4677
# 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_realObject



4679
4680
4681
4682
4683
4684
4685
# 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

#complexityObject



4717
4718
4719
# File 'lib/adlint/cc1/domain.rb', line 4717

def complexity
  1
end

#contain_value_domain?(rhs_dom) ⇒ Boolean

Returns:

  • (Boolean)


3804
3805
3806
# File 'lib/adlint/cc1/domain.rb', line 3804

def contain_value_domain?(rhs_dom)
  rhs_dom._contain_less_than?(self)
end

#each_sampleObject



4699
4700
4701
4702
4703
4704
4705
4706
# 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?Boolean

Returns:

  • (Boolean)


3788
3789
3790
# File 'lib/adlint/cc1/domain.rb', line 3788

def empty?
  false
end

#intersect?(rhs_dom) ⇒ Boolean

Returns:

  • (Boolean)


3836
3837
3838
# File 'lib/adlint/cc1/domain.rb', line 3836

def intersect?(rhs_dom)
  rhs_dom._intersect_less_than?(self)
end

#intersection(rhs_dom) ⇒ Object



4592
4593
4594
# File 'lib/adlint/cc1/domain.rb', line 4592

def intersection(rhs_dom)
  rhs_dom._intersection_less_than(self)
end

#inversionObject



4055
4056
4057
# File 'lib/adlint/cc1/domain.rb', line 4055

def inversion
  ValueDomain.greater_than_or_equal_to(@value, logical_shr?)
end

#logical_and(rhs_dom) ⇒ Object



4516
4517
4518
# 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) ⇒ Object



4554
4555
4556
# File 'lib/adlint/cc1/domain.rb', line 4554

def logical_or(rhs_dom)
  rhs_dom._logical_or_less_than(self)
end

#max_valueObject



4691
4692
4693
4694
4695
4696
4697
# File 'lib/adlint/cc1/domain.rb', line 4691

def max_value
  if @value.integer?
    @value - 1
  else
    @value - Float::EPSILON
  end
end

#min_valueObject



4687
4688
4689
# File 'lib/adlint/cc1/domain.rb', line 4687

def min_value
  nil
end

#nan?Boolean

Returns:

  • (Boolean)


3792
3793
3794
# File 'lib/adlint/cc1/domain.rb', line 3792

def nan?
  false
end

#to_defined_domainObject



4708
4709
4710
# File 'lib/adlint/cc1/domain.rb', line 4708

def to_defined_domain
  self
end

#to_sObject



4712
4713
4714
# File 'lib/adlint/cc1/domain.rb', line 4712

def to_s
  "(< #{@value})"
end

#undefined?Boolean

Returns:

  • (Boolean)


3796
3797
3798
# File 'lib/adlint/cc1/domain.rb', line 3796

def undefined?
  false
end

#union(rhs_dom) ⇒ Object



4633
4634
4635
# File 'lib/adlint/cc1/domain.rb', line 4633

def union(rhs_dom)
  rhs_dom._union_less_than(self)
end

#|(rhs_dom) ⇒ Object



4257
4258
4259
# File 'lib/adlint/cc1/domain.rb', line 4257

def |(rhs_dom)
  rhs_dom.coerce_to_integer._or_less_than(coerce_to_integer)
end

#~Object



4059
4060
4061
# File 'lib/adlint/cc1/domain.rb', line 4059

def ~
  ValueDomain.less_than(~coerce_to_integer.value, logical_shr?)
end