Class: AdLint::Cc1::EqualToValueDomain

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) ⇒ EqualToValueDomain

Returns a new instance of EqualToValueDomain.



2819
2820
2821
2822
2823
2824
2825
2826
# File 'lib/adlint/cc1/domain.rb', line 2819

def initialize(val, logical_shr)
  super(logical_shr)
  if val
    @value = val
  else
    raise ArgumentError, "equal to nil?"
  end
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



2828
2829
2830
# File 'lib/adlint/cc1/domain.rb', line 2828

def value
  @value
end

Instance Method Details

#!Object



3424
3425
3426
3427
3428
3429
3430
# File 'lib/adlint/cc1/domain.rb', line 3424

def !
  if @value == 0
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_false(logical_shr?)
  end
end

#!=(rhs_dom) ⇒ Object



3513
3514
3515
# File 'lib/adlint/cc1/domain.rb', line 3513

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

#&(rhs_dom) ⇒ Object



3254
3255
3256
# File 'lib/adlint/cc1/domain.rb', line 3254

def &(rhs_dom)
  rhs_dom.coerce_to_integer._and_equal_to(coerce_to_integer)
end

#*(rhs_dom) ⇒ Object



3148
3149
3150
# File 'lib/adlint/cc1/domain.rb', line 3148

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

#+(rhs_dom) ⇒ Object



3120
3121
3122
# File 'lib/adlint/cc1/domain.rb', line 3120

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

#+@Object



3112
3113
3114
# File 'lib/adlint/cc1/domain.rb', line 3112

def +@
  self
end

#-@Object



3116
3117
3118
# File 'lib/adlint/cc1/domain.rb', line 3116

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

#/(rhs_dom) ⇒ Object



3204
3205
3206
# File 'lib/adlint/cc1/domain.rb', line 3204

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

#<(rhs_dom) ⇒ Object



3432
3433
3434
# File 'lib/adlint/cc1/domain.rb', line 3432

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

#<<(rhs_dom) ⇒ Object



3352
3353
3354
# File 'lib/adlint/cc1/domain.rb', line 3352

def <<(rhs_dom)
  rhs_dom.coerce_to_integer._shl_equal_to(coerce_to_integer)
end

#==(rhs_dom) ⇒ Object



3473
3474
3475
# File 'lib/adlint/cc1/domain.rb', line 3473

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

#>>(rhs_dom) ⇒ Object



3388
3389
3390
# File 'lib/adlint/cc1/domain.rb', line 3388

def >>(rhs_dom)
  rhs_dom.coerce_to_integer._shr_equal_to(coerce_to_integer)
end

#^(rhs_dom) ⇒ Object



3324
3325
3326
# File 'lib/adlint/cc1/domain.rb', line 3324

def ^(rhs_dom)
  rhs_dom.coerce_to_integer._xor_equal_to(coerce_to_integer)
end

#_add_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3136
3137
3138
# File 'lib/adlint/cc1/domain.rb', line 3136

def _add_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.equal_to(lhs_dom.value + rhs_dom.value, logical_shr?)
end

#_add_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3144
3145
3146
# File 'lib/adlint/cc1/domain.rb', line 3144

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) ⇒ Object



3140
3141
3142
# File 'lib/adlint/cc1/domain.rb', line 3140

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



3124
3125
3126
3127
3128
# File 'lib/adlint/cc1/domain.rb', line 3124

def _add_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes NilValueDomain#_add_equal_to.
  rhs_dom + lhs_dom
end

#_add_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3130
3131
3132
3133
3134
# File 'lib/adlint/cc1/domain.rb', line 3130

def _add_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS + RHS' equals to `RHS + LHS'.
  #       This method invokes UnlimitedValueDomain#_add_equal_to.
  rhs_dom + lhs_dom
end

#_and_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3270
3271
3272
# File 'lib/adlint/cc1/domain.rb', line 3270

def _and_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.equal_to(lhs_dom.value & rhs_dom.value, logical_shr?)
end

#_and_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
# File 'lib/adlint/cc1/domain.rb', line 3285

def _and_greater_than(lhs_dom, rhs_dom = self)
  case
  when rhs_dom.value < 0
    ValueDomain.less_than(0, logical_shr?)
  when rhs_dom.value == 0
    ValueDomain.equal_to(0, logical_shr?)
  when rhs_dom.value > 0
    ValueDomain.greater_than(0, logical_shr?)
  end
end

#_and_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
# File 'lib/adlint/cc1/domain.rb', line 3274

def _and_less_than(lhs_dom, rhs_dom = self)
  case
  when rhs_dom.value < 0
    ValueDomain.less_than(0, logical_shr?)
  when rhs_dom.value == 0
    ValueDomain.equal_to(0, logical_shr?)
  when rhs_dom.value > 0
    ValueDomain.greater_than(0, logical_shr?)
  end
end

#_and_nil(lhs_dom, rhs_dom = self) ⇒ Object



3258
3259
3260
3261
3262
# File 'lib/adlint/cc1/domain.rb', line 3258

def _and_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes NilValueDomain#_and_equal_to.
  rhs_dom & lhs_dom
end

#_and_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3264
3265
3266
3267
3268
# File 'lib/adlint/cc1/domain.rb', line 3264

def _and_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS & RHS' equals to `RHS & LHS'.
  #       This method invokes UnlimitedValueDomain#_and_equal_to.
  rhs_dom & lhs_dom
end

#_contain_equal_to?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2858
2859
2860
# File 'lib/adlint/cc1/domain.rb', line 2858

def _contain_equal_to?(lhs_dom, rhs_dom = self)
  lhs_dom.value == rhs_dom.value
end

#_contain_greater_than?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2866
2867
2868
# File 'lib/adlint/cc1/domain.rb', line 2866

def _contain_greater_than?(lhs_dom, rhs_dom = self)
  lhs_dom.min_value <= rhs_dom.value
end

#_contain_intersection?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2870
2871
2872
# File 'lib/adlint/cc1/domain.rb', line 2870

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)


2862
2863
2864
# File 'lib/adlint/cc1/domain.rb', line 2862

def _contain_less_than?(lhs_dom, rhs_dom = self)
  lhs_dom.max_value >= rhs_dom.value
end

#_contain_nil?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2850
2851
2852
# File 'lib/adlint/cc1/domain.rb', line 2850

def _contain_nil?(lhs_dom, rhs_dom = self)
  false
end

#_contain_union?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2874
2875
2876
# File 'lib/adlint/cc1/domain.rb', line 2874

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)


2854
2855
2856
# File 'lib/adlint/cc1/domain.rb', line 2854

def _contain_unlimited?(lhs_dom, rhs_dom = self)
  true
end

#_div_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3224
3225
3226
3227
3228
3229
3230
# File 'lib/adlint/cc1/domain.rb', line 3224

def _div_equal_to(lhs_dom, rhs_dom = self)
  if rhs_dom.value == 0
    ValueDomain.of_nan(logical_shr?)
  else
    ValueDomain.equal_to(lhs_dom.value / rhs_dom.value, logical_shr?)
  end
end

#_div_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
# File 'lib/adlint/cc1/domain.rb', line 3243

def _div_greater_than(lhs_dom, rhs_dom = self)
  case
  when rhs_dom.value < 0
    ValueDomain.less_than(lhs_dom.value / rhs_dom.value, logical_shr?)
  when rhs_dom.value == 0
    ValueDomain.of_nan(logical_shr?)
  when rhs_dom.value > 0
    ValueDomain.greater_than(lhs_dom.value / rhs_dom.value, logical_shr?)
  end
end

#_div_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
# File 'lib/adlint/cc1/domain.rb', line 3232

def _div_less_than(lhs_dom, rhs_dom = self)
  case
  when rhs_dom.value < 0
    ValueDomain.greater_than(lhs_dom.value / rhs_dom.value, logical_shr?)
  when rhs_dom.value == 0
    ValueDomain.of_nan(logical_shr?)
  when rhs_dom.value > 0
    ValueDomain.less_than(lhs_dom.value / rhs_dom.value, logical_shr?)
  end
end

#_div_nil(lhs_dom, rhs_dom = self) ⇒ Object



3208
3209
3210
3211
3212
3213
3214
# File 'lib/adlint/cc1/domain.rb', line 3208

def _div_nil(lhs_dom, rhs_dom = self)
  if rhs_dom.value == 0
    ValueDomain.of_nan(logical_shr?)
  else
    lhs_dom
  end
end

#_div_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3216
3217
3218
3219
3220
3221
3222
# File 'lib/adlint/cc1/domain.rb', line 3216

def _div_unlimited(lhs_dom, rhs_dom = self)
  if rhs_dom.value == 0
    ValueDomain.of_nan(logical_shr?)
  else
    lhs_dom
  end
end

#_equal_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3489
3490
3491
3492
3493
3494
3495
# File 'lib/adlint/cc1/domain.rb', line 3489

def _equal_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value == rhs_dom.value
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_false(logical_shr?)
  end
end

#_equal_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3505
3506
3507
3508
3509
3510
3511
# File 'lib/adlint/cc1/domain.rb', line 3505

def _equal_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.value
    ValueDomain.of_unlimited(logical_shr?)
  else
    ValueDomain.of_false(logical_shr?)
  end
end

#_equal_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3497
3498
3499
3500
3501
3502
3503
# File 'lib/adlint/cc1/domain.rb', line 3497

def _equal_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= rhs_dom.value
    ValueDomain.of_unlimited(logical_shr?)
  else
    ValueDomain.of_false(logical_shr?)
  end
end

#_equal_nil(lhs_dom, rhs_dom = self) ⇒ Object



3477
3478
3479
3480
3481
# File 'lib/adlint/cc1/domain.rb', line 3477

def _equal_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes NilValueDomain#_equal_equal_to.
  rhs_dom == lhs_dom
end

#_equal_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3483
3484
3485
3486
3487
# File 'lib/adlint/cc1/domain.rb', line 3483

def _equal_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS == RHS' equals to `RHS == LHS'.
  #       This method invokes UnlimitedValueDomain#_equal_equal_to.
  rhs_dom == lhs_dom
end

#_intersect_equal_to?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2895
2896
2897
# File 'lib/adlint/cc1/domain.rb', line 2895

def _intersect_equal_to?(lhs_dom, rhs_dom = self)
  lhs_dom.value == rhs_dom.value
end

#_intersect_greater_than?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2903
2904
2905
# File 'lib/adlint/cc1/domain.rb', line 2903

def _intersect_greater_than?(lhs_dom, rhs_dom = self)
  lhs_dom.min_value <= rhs_dom.value
end

#_intersect_less_than?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2899
2900
2901
# File 'lib/adlint/cc1/domain.rb', line 2899

def _intersect_less_than?(lhs_dom, rhs_dom = self)
  lhs_dom.max_value >= rhs_dom.value
end

#_intersect_nil?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2882
2883
2884
2885
2886
# File 'lib/adlint/cc1/domain.rb', line 2882

def _intersect_nil?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes NilValueDomain#_intersect_equal_to?.
  rhs_dom.intersect?(lhs_dom)
end

#_intersect_unlimited?(lhs_dom, rhs_dom = self) ⇒ Boolean

Returns:

  • (Boolean)


2888
2889
2890
2891
2892
2893
# File 'lib/adlint/cc1/domain.rb', line 2888

def _intersect_unlimited?(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersect? RHS' equals to `RHS intersect? LHS'.
  #       This method invokes
  #       UnlimitedValueDomain#_intersect_equal_to?.
  rhs_dom.intersect?(lhs_dom)
end

#_intersection_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3665
3666
3667
3668
3669
3670
3671
# File 'lib/adlint/cc1/domain.rb', line 3665

def _intersection_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value == rhs_dom.value
    lhs_dom
  else
    ValueDomain.of_nil(logical_shr?)
  end
end

#_intersection_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3681
3682
3683
3684
3685
3686
3687
# File 'lib/adlint/cc1/domain.rb', line 3681

def _intersection_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.value
    rhs_dom
  else
    ValueDomain.of_nil(logical_shr?)
  end
end

#_intersection_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3673
3674
3675
3676
3677
3678
3679
# File 'lib/adlint/cc1/domain.rb', line 3673

def _intersection_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= rhs_dom.value
    rhs_dom
  else
    ValueDomain.of_nil(logical_shr?)
  end
end

#_intersection_nil(lhs_dom, rhs_dom = self) ⇒ Object



3653
3654
3655
3656
3657
# File 'lib/adlint/cc1/domain.rb', line 3653

def _intersection_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes NilValueDomain#_intersection_equal_to.
  rhs_dom.intersection(lhs_dom)
end

#_intersection_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3659
3660
3661
3662
3663
# File 'lib/adlint/cc1/domain.rb', line 3659

def _intersection_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS intersection RHS' equals to `RHS intersection LHS'.
  #       This method invokes UnlimitedValueDomain#_intersection_equal_to.
  rhs_dom.intersection(lhs_dom)
end

#_less_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3449
3450
3451
3452
3453
3454
3455
# File 'lib/adlint/cc1/domain.rb', line 3449

def _less_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value < rhs_dom.value
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_false(logical_shr?)
  end
end

#_less_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3465
3466
3467
3468
3469
3470
3471
# File 'lib/adlint/cc1/domain.rb', line 3465

def _less_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value > rhs_dom.value
    ValueDomain.of_false(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end

#_less_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3457
3458
3459
3460
3461
3462
3463
# File 'lib/adlint/cc1/domain.rb', line 3457

def _less_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value < rhs_dom.value
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end

#_less_nil(lhs_dom, rhs_dom = self) ⇒ Object



3436
3437
3438
3439
3440
# File 'lib/adlint/cc1/domain.rb', line 3436

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



3442
3443
3444
3445
3446
3447
# File 'lib/adlint/cc1/domain.rb', line 3442

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



3569
3570
3571
3572
3573
3574
3575
# File 'lib/adlint/cc1/domain.rb', line 3569

def _logical_and_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value == 0 || rhs_dom.value == 0
    ValueDomain.of_false(logical_shr?)
  else
    ValueDomain.of_true(logical_shr?)
  end
end

#_logical_and_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
# File 'lib/adlint/cc1/domain.rb', line 3589

def _logical_and_greater_than(lhs_dom, rhs_dom = self)
  if rhs_dom.value == 0
    ValueDomain.of_false(logical_shr?)
  else
    if lhs_dom.value > 0
      ValueDomain.of_true(logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  end
end

#_logical_and_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
# File 'lib/adlint/cc1/domain.rb', line 3577

def _logical_and_less_than(lhs_dom, rhs_dom = self)
  if rhs_dom.value == 0
    ValueDomain.of_false(logical_shr?)
  else
    if lhs_dom.value < 0
      ValueDomain.of_true(logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  end
end

#_logical_and_nil(lhs_dom, rhs_dom = self) ⇒ Object



3557
3558
3559
3560
3561
# File 'lib/adlint/cc1/domain.rb', line 3557

def _logical_and_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes NilValueDomain#_logical_and_equal_to.
  rhs_dom.logical_and(lhs_dom)
end

#_logical_and_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3563
3564
3565
3566
3567
# File 'lib/adlint/cc1/domain.rb', line 3563

def _logical_and_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS && RHS' equals to `RHS && LHS'.
  #       This method invokes UnlimitedValueDomain#_logical_and_equal_to.
  rhs_dom.logical_and(lhs_dom)
end

#_logical_or_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3617
3618
3619
3620
3621
3622
3623
# File 'lib/adlint/cc1/domain.rb', line 3617

def _logical_or_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value == 0 && rhs_dom.value == 0
    ValueDomain.of_false(logical_shr?)
  else
    ValueDomain.of_true(logical_shr?)
  end
end

#_logical_or_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
# File 'lib/adlint/cc1/domain.rb', line 3637

def _logical_or_greater_than(lhs_dom, rhs_dom = self)
  if rhs_dom.value == 0
    if lhs_dom.value > 0
      ValueDomain.of_true(logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  else
    ValueDomain.of_true(logical_shr?)
  end
end

#_logical_or_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
# File 'lib/adlint/cc1/domain.rb', line 3625

def _logical_or_less_than(lhs_dom, rhs_dom = self)
  if rhs_dom.value == 0
    if lhs_dom.value < 0
      ValueDomain.of_true(logical_shr?)
    else
      ValueDomain.of_unlimited(logical_shr?)
    end
  else
    ValueDomain.of_true(logical_shr?)
  end
end

#_logical_or_nil(lhs_dom, rhs_dom = self) ⇒ Object



3605
3606
3607
3608
3609
# File 'lib/adlint/cc1/domain.rb', line 3605

def _logical_or_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes NilValueDomain#_logical_or_equal_to.
  rhs_dom.logical_or(lhs_dom)
end

#_logical_or_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3611
3612
3613
3614
3615
# File 'lib/adlint/cc1/domain.rb', line 3611

def _logical_or_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS || RHS' equals to `RHS || LHS'.
  #       This method invokes UnlimitedValueDomain#_logical_or_equal_to.
  rhs_dom.logical_or(lhs_dom)
end

#_mul_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3164
3165
3166
# File 'lib/adlint/cc1/domain.rb', line 3164

def _mul_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.equal_to(lhs_dom.value * rhs_dom.value, logical_shr?)
end

#_mul_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
# File 'lib/adlint/cc1/domain.rb', line 3186

def _mul_greater_than(lhs_dom, rhs_dom = self)
  return ValueDomain.equal_to(0, logical_shr?) if rhs_dom.value == 0

  if lhs_dom.value >= 0
    if rhs_dom.value < 0
      ValueDomain.less_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    else
      ValueDomain.greater_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    end
  else
    if rhs_dom.value < 0
      ValueDomain.less_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    else
      ValueDomain.greater_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    end
  end
end

#_mul_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
# File 'lib/adlint/cc1/domain.rb', line 3168

def _mul_less_than(lhs_dom, rhs_dom = self)
  return ValueDomain.equal_to(0, logical_shr?) if rhs_dom.value == 0

  if lhs_dom.value <= 0
    if rhs_dom.value < 0
      ValueDomain.greater_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    else
      ValueDomain.less_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    end
  else
    if rhs_dom.value < 0
      ValueDomain.greater_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    else
      ValueDomain.less_than(lhs_dom.value * rhs_dom.value, logical_shr?)
    end
  end
end

#_mul_nil(lhs_dom, rhs_dom = self) ⇒ Object



3152
3153
3154
3155
3156
# File 'lib/adlint/cc1/domain.rb', line 3152

def _mul_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes NilValueDomain#_mul_equal_to.
  rhs_dom * lhs_dom
end

#_mul_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3158
3159
3160
3161
3162
# File 'lib/adlint/cc1/domain.rb', line 3158

def _mul_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS * RHS' equals to `RHS * LHS'.
  #       This method invokes UnlimitedValueDomain#_mul_equal_to.
  rhs_dom * lhs_dom
end

#_narrow_by_eq(rhs_dom, lhs_dom = self) ⇒ Object



2907
2908
2909
# File 'lib/adlint/cc1/domain.rb', line 2907

def _narrow_by_eq(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_equal_to_by_eq(lhs_dom)
end

#_narrow_by_gt(rhs_dom, lhs_dom = self) ⇒ Object



3051
3052
3053
# File 'lib/adlint/cc1/domain.rb', line 3051

def _narrow_by_gt(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_equal_to_by_gt(lhs_dom)
end

#_narrow_by_lt(rhs_dom, lhs_dom = self) ⇒ Object



3007
3008
3009
# File 'lib/adlint/cc1/domain.rb', line 3007

def _narrow_by_lt(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_equal_to_by_lt(lhs_dom)
end

#_narrow_by_ne(rhs_dom, lhs_dom = self) ⇒ Object



2958
2959
2960
# File 'lib/adlint/cc1/domain.rb', line 2958

def _narrow_by_ne(rhs_dom, lhs_dom = self)
  rhs_dom._narrow_equal_to_by_ne(lhs_dom)
end

#_narrow_equal_to_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
# File 'lib/adlint/cc1/domain.rb', line 2922

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



3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
# File 'lib/adlint/cc1/domain.rb', line 3066

def _narrow_equal_to_by_gt(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_lt(lhs_dom, rhs_dom = self) ⇒ Object



3022
3023
3024
3025
3026
3027
3028
# File 'lib/adlint/cc1/domain.rb', line 3022

def _narrow_equal_to_by_lt(lhs_dom, rhs_dom = self)
  if lhs_dom.value < rhs_dom.value
    lhs_dom
  else
    ValueDomain.of_nil(logical_shr?)
  end
end

#_narrow_equal_to_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
# File 'lib/adlint/cc1/domain.rb', line 2973

def _narrow_equal_to_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.value == rhs_dom.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



2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
# File 'lib/adlint/cc1/domain.rb', line 2946

def _narrow_greater_than_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.value
    # NOTE: Narrowing `---<=========' by `== --------|---' makes
    #       `---------|---'.
    rhs_dom
  else
    # NOTE: Narrowing `---------<===' by `== ---|--------' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end

#_narrow_greater_than_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
# File 'lib/adlint/cc1/domain.rb', line 3091

def _narrow_greater_than_by_gt(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.value
    # NOTE: Narrowing `---<=========' by `> ------|------' makes
    #       `------<======'.
    ValueDomain.greater_than(rhs_dom.value, logical_shr?)
  else
    # NOTE: Narrowing `---------<===' by `> ---|---------' makes
    #       `---------<==='.
    lhs_dom
  end
end

#_narrow_greater_than_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
# File 'lib/adlint/cc1/domain.rb', line 3040

def _narrow_greater_than_by_lt(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.value
    # NOTE: Narrowing `---<=========' by `< ------|------' makes
    #       `---<=>-------'.
    lhs_dom.intersection(
      ValueDomain.less_than(rhs_dom.value, logical_shr?))
  else
    ValueDomain.of_nil(logical_shr?)
  end
end

#_narrow_greater_than_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



2997
2998
2999
3000
3001
3002
3003
3004
3005
# File 'lib/adlint/cc1/domain.rb', line 2997

def _narrow_greater_than_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.value
    # NOTE: Narrowing `---<=========' by `!= ------|------' makes
    #       `---<=>-<====='.
    lhs_dom.intersection(rhs_dom.inversion)
  else
    lhs_dom
  end
end

#_narrow_less_than_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
# File 'lib/adlint/cc1/domain.rb', line 2934

def _narrow_less_than_by_eq(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= rhs_dom.value
    # NOTE: Narrowing `=========>---' by `== ---|--------' makes
    #       `---|---------'.
    rhs_dom
  else
    # NOTE: Narrowing `===>---------' by `== --------|---' makes
    #       `-------------'.
    ValueDomain.of_nil(logical_shr?)
  end
end

#_narrow_less_than_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
# File 'lib/adlint/cc1/domain.rb', line 3078

def _narrow_less_than_by_gt(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= rhs_dom.value
    # NOTE: Narrowing `=========>---' by `> ---|---------' makes
    #       `---<=====>---'.
    ValueDomain.greater_than(rhs_dom.value,
                             logical_shr?).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



3030
3031
3032
3033
3034
3035
3036
3037
3038
# File 'lib/adlint/cc1/domain.rb', line 3030

def _narrow_less_than_by_lt(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= rhs_dom.value
    # NOTE: Narrowing `=========>---' by `< ------|------' makes
    #       `=====>-------'.
    ValueDomain.less_than(rhs_dom.value, logical_shr?)
  else
    lhs_dom
  end
end

#_narrow_less_than_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
# File 'lib/adlint/cc1/domain.rb', line 2985

def _narrow_less_than_by_ne(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= rhs_dom.value
    # NOTE: Narrowing `=========>---' by `!= ------|------' makes
    #       `=====>-<=>---'.
    lhs_dom.intersection(rhs_dom.inversion)
  else
    # NOTE: Narrowing `===>---------' by `!= ------|------' makes
    #       `===>---------'.
    lhs_dom
  end
end

#_narrow_nil_by_eq(lhs_dom, rhs_dom = self) ⇒ Object



2911
2912
2913
2914
2915
2916
# File 'lib/adlint/cc1/domain.rb', line 2911

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



3055
3056
3057
3058
3059
3060
# File 'lib/adlint/cc1/domain.rb', line 3055

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



3011
3012
3013
3014
3015
3016
# File 'lib/adlint/cc1/domain.rb', line 3011

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



2962
2963
2964
2965
2966
2967
# File 'lib/adlint/cc1/domain.rb', line 2962

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



2918
2919
2920
# File 'lib/adlint/cc1/domain.rb', line 2918

def _narrow_unlimited_by_eq(lhs_dom, rhs_dom = self)
  rhs_dom
end

#_narrow_unlimited_by_gt(lhs_dom, rhs_dom = self) ⇒ Object



3062
3063
3064
# File 'lib/adlint/cc1/domain.rb', line 3062

def _narrow_unlimited_by_gt(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(rhs_dom.value, logical_shr?)
end

#_narrow_unlimited_by_lt(lhs_dom, rhs_dom = self) ⇒ Object



3018
3019
3020
# File 'lib/adlint/cc1/domain.rb', line 3018

def _narrow_unlimited_by_lt(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(rhs_dom.value, logical_shr?)
end

#_narrow_unlimited_by_ne(lhs_dom, rhs_dom = self) ⇒ Object



2969
2970
2971
# File 'lib/adlint/cc1/domain.rb', line 2969

def _narrow_unlimited_by_ne(lhs_dom, rhs_dom = self)
  rhs_dom.inversion
end

#_not_equal_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3529
3530
3531
3532
3533
3534
3535
# File 'lib/adlint/cc1/domain.rb', line 3529

def _not_equal_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value != rhs_dom.value
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_false(logical_shr?)
  end
end

#_not_equal_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3545
3546
3547
3548
3549
3550
3551
# File 'lib/adlint/cc1/domain.rb', line 3545

def _not_equal_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value > rhs_dom.value
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end

#_not_equal_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3537
3538
3539
3540
3541
3542
3543
# File 'lib/adlint/cc1/domain.rb', line 3537

def _not_equal_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value < rhs_dom.value
    ValueDomain.of_true(logical_shr?)
  else
    ValueDomain.of_unlimited(logical_shr?)
  end
end

#_not_equal_nil(lhs_dom, rhs_dom = self) ⇒ Object



3517
3518
3519
3520
3521
# File 'lib/adlint/cc1/domain.rb', line 3517

def _not_equal_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes NilValueDomain#_not_equal_equal_to.
  rhs_dom != lhs_dom
end

#_not_equal_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3523
3524
3525
3526
3527
# File 'lib/adlint/cc1/domain.rb', line 3523

def _not_equal_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS != RHS' equals to `RHS != LHS'.
  #       This method invokes UnlimitedValueDomain#_not_equal_equal_to.
  rhs_dom != lhs_dom
end

#_or_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3312
3313
3314
# File 'lib/adlint/cc1/domain.rb', line 3312

def _or_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.equal_to(lhs_dom.value | rhs_dom.value, logical_shr?)
end

#_or_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3320
3321
3322
# File 'lib/adlint/cc1/domain.rb', line 3320

def _or_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(lhs_dom.value | rhs_dom.value, logical_shr?)
end

#_or_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3316
3317
3318
# File 'lib/adlint/cc1/domain.rb', line 3316

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



3300
3301
3302
3303
3304
# File 'lib/adlint/cc1/domain.rb', line 3300

def _or_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes NilValueDomain#_or_equal_to.
  rhs_dom | lhs_dom
end

#_or_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3306
3307
3308
3309
3310
# File 'lib/adlint/cc1/domain.rb', line 3306

def _or_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS | RHS' equals to `RHS | LHS'.
  #       This method invokes UnlimitedValueDomain#_or_equal_to.
  rhs_dom | lhs_dom
end

#_shl_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3373
3374
3375
3376
# File 'lib/adlint/cc1/domain.rb', line 3373

def _shl_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.equal_to(left_shift(lhs_dom.value, rhs_dom.value),
                       logical_shr?)
end

#_shl_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3383
3384
3385
3386
# File 'lib/adlint/cc1/domain.rb', line 3383

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) ⇒ Object



3378
3379
3380
3381
# File 'lib/adlint/cc1/domain.rb', line 3378

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



3356
3357
3358
3359
3360
3361
# File 'lib/adlint/cc1/domain.rb', line 3356

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



3363
3364
3365
3366
3367
3368
3369
3370
3371
# File 'lib/adlint/cc1/domain.rb', line 3363

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



3409
3410
3411
3412
# File 'lib/adlint/cc1/domain.rb', line 3409

def _shr_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.equal_to(right_shift(lhs_dom.value, rhs_dom.value),
                       logical_shr?)
end

#_shr_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3419
3420
3421
3422
# File 'lib/adlint/cc1/domain.rb', line 3419

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



3414
3415
3416
3417
# File 'lib/adlint/cc1/domain.rb', line 3414

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) ⇒ Object



3392
3393
3394
3395
3396
3397
# File 'lib/adlint/cc1/domain.rb', line 3392

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



3399
3400
3401
3402
3403
3404
3405
3406
3407
# File 'lib/adlint/cc1/domain.rb', line 3399

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



3705
3706
3707
3708
3709
3710
3711
# File 'lib/adlint/cc1/domain.rb', line 3705

def _union_equal_to(lhs_dom, rhs_dom = self)
  if lhs_dom.value == rhs_dom.value
    lhs_dom
  else
    ValueDomain._create_union(lhs_dom, rhs_dom)
  end
end

#_union_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3721
3722
3723
3724
3725
3726
3727
# File 'lib/adlint/cc1/domain.rb', line 3721

def _union_greater_than(lhs_dom, rhs_dom = self)
  if lhs_dom.min_value <= rhs_dom.value
    lhs_dom
  else
    ValueDomain._create_union(lhs_dom, rhs_dom)
  end
end

#_union_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3713
3714
3715
3716
3717
3718
3719
# File 'lib/adlint/cc1/domain.rb', line 3713

def _union_less_than(lhs_dom, rhs_dom = self)
  if lhs_dom.max_value >= rhs_dom.value
    lhs_dom
  else
    ValueDomain._create_union(lhs_dom, rhs_dom)
  end
end

#_union_nil(lhs_dom, rhs_dom = self) ⇒ Object



3693
3694
3695
3696
3697
# File 'lib/adlint/cc1/domain.rb', line 3693

def _union_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes NilValueDomain#_union_equal_to.
  rhs_dom.union(lhs_dom)
end

#_union_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3699
3700
3701
3702
3703
# File 'lib/adlint/cc1/domain.rb', line 3699

def _union_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS union RHS' equals to `RHS union LHS'.
  #       This method invokes UnlimitedValueDomain#_union_equal_to.
  rhs_dom.union(lhs_dom)
end

#_xor_equal_to(lhs_dom, rhs_dom = self) ⇒ Object



3340
3341
3342
# File 'lib/adlint/cc1/domain.rb', line 3340

def _xor_equal_to(lhs_dom, rhs_dom = self)
  ValueDomain.equal_to(lhs_dom.value ^ rhs_dom.value, logical_shr?)
end

#_xor_greater_than(lhs_dom, rhs_dom = self) ⇒ Object



3348
3349
3350
# File 'lib/adlint/cc1/domain.rb', line 3348

def _xor_greater_than(lhs_dom, rhs_dom = self)
  ValueDomain.greater_than(lhs_dom.value ^ rhs_dom.value, logical_shr?)
end

#_xor_less_than(lhs_dom, rhs_dom = self) ⇒ Object



3344
3345
3346
# File 'lib/adlint/cc1/domain.rb', line 3344

def _xor_less_than(lhs_dom, rhs_dom = self)
  ValueDomain.less_than(lhs_dom.value ^ rhs_dom.value, logical_shr?)
end

#_xor_nil(lhs_dom, rhs_dom = self) ⇒ Object



3328
3329
3330
3331
3332
# File 'lib/adlint/cc1/domain.rb', line 3328

def _xor_nil(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes NilValueDomain#_xor_equal_to.
  rhs_dom ^ lhs_dom
end

#_xor_unlimited(lhs_dom, rhs_dom = self) ⇒ Object



3334
3335
3336
3337
3338
# File 'lib/adlint/cc1/domain.rb', line 3334

def _xor_unlimited(lhs_dom, rhs_dom = self)
  # NOTE: `LHS ^ RHS' equals to `RHS ^ LHS'.
  #       This method invokes UnlimitedValueDomain#_xor_equal_to.
  rhs_dom ^ lhs_dom
end

#ambiguous?Boolean

Returns:

  • (Boolean)


2842
2843
2844
# File 'lib/adlint/cc1/domain.rb', line 2842

def ambiguous?
  false
end

#coerce_to_integerObject



3729
3730
3731
3732
3733
3734
3735
# File 'lib/adlint/cc1/domain.rb', line 3729

def coerce_to_integer
  if @value.integer?
    self
  else
    ValueDomain.equal_to(@value.to_i, logical_shr?)
  end
end

#coerce_to_realObject



3737
3738
3739
3740
3741
3742
3743
# File 'lib/adlint/cc1/domain.rb', line 3737

def coerce_to_real
  if @value.real?
    self
  else
    ValueDomain.equal_to(@value.to_f, logical_shr?)
  end
end

#complexityObject



3771
3772
3773
# File 'lib/adlint/cc1/domain.rb', line 3771

def complexity
  1
end

#contain_value_domain?(rhs_dom) ⇒ Boolean

Returns:

  • (Boolean)


2846
2847
2848
# File 'lib/adlint/cc1/domain.rb', line 2846

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

#each_sampleObject



3753
3754
3755
3756
3757
3758
3759
3760
# File 'lib/adlint/cc1/domain.rb', line 3753

def each_sample
  if block_given?
    yield(@value)
    self
  else
    to_enum(:each_sample)
  end
end

#empty?Boolean

Returns:

  • (Boolean)


2830
2831
2832
# File 'lib/adlint/cc1/domain.rb', line 2830

def empty?
  false
end

#intersect?(rhs_dom) ⇒ Boolean

Returns:

  • (Boolean)


2878
2879
2880
# File 'lib/adlint/cc1/domain.rb', line 2878

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

#intersection(rhs_dom) ⇒ Object



3649
3650
3651
# File 'lib/adlint/cc1/domain.rb', line 3649

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

#inversionObject



3103
3104
3105
3106
# File 'lib/adlint/cc1/domain.rb', line 3103

def inversion
  ValueDomain.less_than(@value, logical_shr?).union(
    ValueDomain.greater_than(@value, logical_shr?))
end

#logical_and(rhs_dom) ⇒ Object



3553
3554
3555
# File 'lib/adlint/cc1/domain.rb', line 3553

def logical_and(rhs_dom)
  rhs_dom._logical_and_equal_to(self)
end

#logical_or(rhs_dom) ⇒ Object



3601
3602
3603
# File 'lib/adlint/cc1/domain.rb', line 3601

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

#max_valueObject



3749
3750
3751
# File 'lib/adlint/cc1/domain.rb', line 3749

def max_value
  @value
end

#min_valueObject



3745
3746
3747
# File 'lib/adlint/cc1/domain.rb', line 3745

def min_value
  @value
end

#nan?Boolean

Returns:

  • (Boolean)


2834
2835
2836
# File 'lib/adlint/cc1/domain.rb', line 2834

def nan?
  false
end

#to_defined_domainObject



3762
3763
3764
# File 'lib/adlint/cc1/domain.rb', line 3762

def to_defined_domain
  self
end

#to_sObject



3766
3767
3768
# File 'lib/adlint/cc1/domain.rb', line 3766

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

#undefined?Boolean

Returns:

  • (Boolean)


2838
2839
2840
# File 'lib/adlint/cc1/domain.rb', line 2838

def undefined?
  false
end

#union(rhs_dom) ⇒ Object



3689
3690
3691
# File 'lib/adlint/cc1/domain.rb', line 3689

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

#|(rhs_dom) ⇒ Object



3296
3297
3298
# File 'lib/adlint/cc1/domain.rb', line 3296

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

#~Object



3108
3109
3110
# File 'lib/adlint/cc1/domain.rb', line 3108

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