ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
bitwise_bounds.h
Go to the documentation of this file.
1#ifndef BITWISE_BOUNDS_H_INCLUDED
2#define BITWISE_BOUNDS_H_INCLUDED
3
4#define UINT_X unsigned
5#define INT_X int
6
19{
20 UINT_X extra_bits = 0;
21
22 // scan all the bits that are active in both upper bounds
23 UINT_X cand_bits = b & d;
24 while (cand_bits != 0)
25 {
26 // isolate the least significant candidate bit
27 // e.g. cand_bits = 0b01101010 yields least_bit = 0b00000010
28 UINT_X least_bit = cand_bits & (-cand_bits);
29
30 // reduce b and d by removing least_bit and activating all the less
31 // significant ones e.g. b = 0b00101100 and least_bit = 0b00001000 yields
32 // alternate_b = 0b00100111
33 UINT_X alternate_b = (b - least_bit) | (least_bit - 1);
34 UINT_X alternate_d = (d - least_bit) | (least_bit - 1);
35
36 // stop only if both alternate values are outside of the valid interval
37 if (alternate_b < a && alternate_d < c)
38 break;
39
40 // collect the extra activated bits
41 // e.g. least_bit = 0b00001000 yields extra_bits |= 0b00000111
42 extra_bits |= (least_bit - 1);
43
44 // remove the least significant bit from the candidates until none is left
45 cand_bits &= (cand_bits - 1);
46 }
47
48 // the maximum value is the disjunction of both upper bounds and the extra
49 // bits
50 return b | d | extra_bits;
51}
52
65{
66 UINT_X best_a = a;
67 UINT_X best_c = c;
68
69 // scan all the bits that are already active in the other lower bound
70 UINT_X cand_bits = ~a & c;
71 while (cand_bits != 0)
72 {
73 // isolate the least significant candidate bit
74 // e.g. cand_bits = 0b01101010 yields least_bit = 0b00000010
75 UINT_X least_bit = cand_bits & (-cand_bits);
76
77 // increase a by adding least_bit and de-activating all the less significant
78 // ones e.g. a = 0b00101100 and least_bit = 0b00010000 yields alternate_a =
79 // 0b00110000
80 UINT_X alternate_a = (a | least_bit) & (-least_bit);
81
82 // stop if the alternate value is outside of the valid interval
83 if (alternate_a > b)
84 break;
85
86 // keep track of the best value of a found so far
87 best_a = alternate_a;
88
89 // remove the least significant bit from the candidates until none is left
90 cand_bits &= (cand_bits - 1);
91 }
92
93 // repeat the same procedure for the interval y in [c,d]
94 cand_bits = a & ~c;
95 while (cand_bits != 0)
96 {
97 UINT_X least_bit = cand_bits & (-cand_bits);
98 UINT_X alternate_c = (c | least_bit) & (-least_bit);
99 if (alternate_c > d)
100 break;
101 best_c = alternate_c;
102 cand_bits &= (cand_bits - 1);
103 }
104
105 // compute two separate bounds with the modified a and c
106 // note: since best_a >= a and best_c >= c,
107 // using best_a | best_c could give unsound results
108 UINT_X min_1 = best_a | c;
109 UINT_X min_2 = a | best_c;
110
111 // return the lowest bound
112 return (min_1 < min_2) ? min_1 : min_2;
113}
114
126{
127 return ~unsigned_min_or(~b, ~a, ~d, ~c);
128}
129
141{
142 return ~unsigned_max_or(~b, ~a, ~d, ~c);
143}
144
156{
157 return unsigned_max_or(
158 0, unsigned_max_and(a, b, ~d, ~c), 0, unsigned_max_and(~b, ~a, c, d));
159}
160
172{
173 return unsigned_min_and(a, b, ~d, ~c) | unsigned_min_and(~b, ~a, c, d);
174}
175
185{
186 return ~a;
187}
188
198{
199 return ~b;
200}
201
212{
213 return b << d;
214}
215
226{
227 return a << c;
228}
229
240{
241 return b >> c;
242}
243
254{
255 return a >> d;
256}
257
268{
269 // set the n least significant bits to one
270 UINT_X sign_bit = 1 << (n - 1);
271 UINT_X mask = sign_bit | (sign_bit - 1);
272
273 // compute the maximum value of x & mask
274 return unsigned_max_and(a, b, mask, mask);
275}
276
287{
288 // set the n least significant bits to one
289 UINT_X sign_bit = 1 << (n - 1);
290 UINT_X mask = sign_bit | (sign_bit - 1);
291
292 // compute the minimum value of x & mask
293 return unsigned_min_and(a, b, mask, mask);
294}
295
306{
307 // if the input interval contains zero, return truncated -1
308 if (a < 0 && b >= 0)
309 return (1 << n) - 1;
310
311 // otherwise interpret [a,b] as an unsigned interval
312 else
313 return unsigned_2_unsigned_max_truncate(a, b, n);
314}
315
326{
327 // if the input interval contains zero, return zero
328 if (a < 0 && b >= 0)
329 return 0;
330
331 // otherwise interpret [a,b] as an unsigned interval
332 else
333 return unsigned_2_unsigned_min_truncate(a, b, n);
334}
335
346{
347 // isolate the sign bit of the input
348 UINT_X sign_bit = 1 << (n - 1);
349
350 // set the n least significant bits to one
351 UINT_X mask = sign_bit | (sign_bit - 1);
352
353 // if a <= 0 and b > 0, return the n-bit representation of -1
354 if ((a & sign_bit) != 0 && (b & sign_bit) == 0)
355 return -1 & mask;
356
357 // otherwise, extend the upper bound
358 return b & mask;
359}
360
371{
372 // isolate the sign bit of the input
373 UINT_X sign_bit = 1 << (n - 1);
374
375 // set the n least significant bits to one
376 UINT_X mask = sign_bit | (sign_bit - 1);
377
378 // if a <= 0 and b > 0, return zero
379 if ((a & sign_bit) != 0 && (b & sign_bit) == 0)
380 return 0;
381
382 // otherwise, extend the upper bound
383 return a & mask;
384}
385
398{
399 if (a < 0)
400 {
401 if (b < 0)
402 {
403 if (c < 0)
404 {
405 if (d < 0)
406 {
407 return unsigned_max_or(a, b, c, d); // a < 0, b < 0, c < 0, d < 0
408 }
409 else
410 {
411 return -1; // a < 0, b < 0, c < 0, d >= 0
412 }
413 }
414 else
415 {
416 return unsigned_max_or(a, b, c, d); // a < 0, b < 0, c >= 0, d >= 0
417 }
418 }
419 else
420 {
421 if (c < 0)
422 {
423 if (d < 0)
424 {
425 return -1; // a < 0, b >= 0, c < 0, d < 0
426 }
427 else
428 {
429 return unsigned_max_or(0, b, 0, d); // a < 0, b >= 0, c < 0, d >= 0
430 }
431 }
432 else
433 {
434 return unsigned_max_or(0, b, c, d); // a < 0, b >= 0, c >= 0, d >= 0
435 }
436 }
437 }
438 else
439 {
440 if (c < 0)
441 {
442 if (d < 0)
443 {
444 return unsigned_max_or(a, b, c, d); // a >= 0, b >= 0, c < 0, d < 0
445 }
446 else
447 {
448 return unsigned_max_or(a, b, 0, d); // a >= 0, b >= 0, c < 0, d >= 0
449 }
450 }
451 else
452 {
453 return unsigned_max_or(a, b, c, d); // a >= 0, b >= 0, c >= 0, d >= 0
454 }
455 }
456}
457
470{
471 if (a < 0)
472 {
473 if (b < 0)
474 {
475 if (c < 0)
476 {
477 if (d < 0)
478 {
479 return unsigned_min_or(a, b, c, d); // a < 0, b < 0, c < 0, d < 0
480 }
481 else
482 {
483 return a; // a < 0, b < 0, c < 0, d >= 0
484 }
485 }
486 else
487 {
488 return unsigned_min_or(a, b, c, d); // a < 0, b < 0, c >= 0, d >= 0
489 }
490 }
491 else
492 {
493 if (c < 0)
494 {
495 if (d < 0)
496 {
497 return c; // a < 0, b >= 0, c < 0, d < 0
498 }
499 else
500 {
501 return (a < c) ? a : c; // a < 0, b >= 0, c < 0, d >= 0
502 }
503 }
504 else
505 {
506 return unsigned_min_or(a, -1, c, d); // a < 0, b >= 0, c >= 0, d >= 0
507 }
508 }
509 }
510 else
511 {
512 if (c < 0)
513 {
514 if (d < 0)
515 {
516 return unsigned_min_or(a, b, c, d); // a >= 0, b >= 0, c < 0, d < 0
517 }
518 else
519 {
520 return unsigned_min_or(a, b, c, -1); // a >= 0, b >= 0, c < 0, d >= 0
521 }
522 }
523 else
524 {
525 return unsigned_min_or(a, b, c, d); // a >= 0, b >= 0, c >= 0, d >= 0
526 }
527 }
528}
529
542{
543 return ~signed_min_or(~b, ~a, ~d, ~c);
544}
545
558{
559 return ~signed_max_or(~b, ~a, ~d, ~c);
560}
561
575{
576 if (a < 0)
577 {
578 if (b < 0)
579 {
580 if (c < 0)
581 {
582 if (d < 0)
583 {
584 return unsigned_max_xor(a, b, c, d); // a < 0, b < 0, c < 0, d < 0
585 }
586 else
587 {
588 return unsigned_max_xor(a, b, c, -1); // a < 0, b < 0, c < 0, d >= 0
589 }
590 }
591 else
592 {
593 return unsigned_max_xor(a, b, c, d); // a < 0, b < 0, c >= 0, d >= 0
594 }
595 }
596 else
597 {
598 if (c < 0)
599 {
600 if (d < 0)
601 {
602 return unsigned_max_xor(a, -1, c, d); // a < 0, b >= 0, c < 0, d < 0
603 }
604 else
605 {
606 INT_X e = unsigned_max_xor(a, -1, c, -1);
607 INT_X f = unsigned_max_xor(0, b, 0, d);
608 return (e > f) ? e : f; // a < 0, b >= 0, c < 0, d >= 0
609 }
610 }
611 else
612 {
613 return unsigned_max_xor(0, b, c, d); // a < 0, b >= 0, c >= 0, d >= 0
614 }
615 }
616 }
617 else
618 {
619 if (c < 0)
620 {
621 if (d < 0)
622 {
623 return unsigned_max_xor(a, b, c, d); // a >= 0, b >= 0, c < 0, d < 0
624 }
625 else
626 {
627 return unsigned_max_xor(a, b, 0, d); // a >= 0, b >= 0, c < 0, d >= 0
628 }
629 }
630 else
631 {
632 return unsigned_max_xor(a, b, c, d); // a >= 0, b >= 0, c >= 0, d >= 0
633 }
634 }
635}
636
650{
651 if (a < 0)
652 {
653 if (b < 0)
654 {
655 if (c < 0)
656 {
657 if (d < 0)
658 {
659 return unsigned_min_xor(a, b, c, d); // a < 0, b < 0, c < 0, d < 0
660 }
661 else
662 {
663 return unsigned_min_xor(a, b, 0, d); // a < 0, b < 0, c < 0, d >= 0
664 }
665 }
666 else
667 {
668 return unsigned_min_xor(a, b, c, d); // a < 0, b < 0, c >= 0, d >= 0
669 }
670 }
671 else
672 {
673 if (c < 0)
674 {
675 if (d < 0)
676 {
677 return unsigned_min_xor(0, b, c, d); // a < 0, b >= 0, c < 0, d < 0
678 }
679 else
680 {
681 INT_X e = unsigned_min_xor(a, -1, 0, d);
682 INT_X f = unsigned_min_xor(0, b, c, -1);
683 return (e < f) ? e : f; // a < 0, b >= 0, c < 0, d >= 0
684 }
685 }
686 else
687 {
688 return unsigned_min_xor(a, -1, c, d); // a < 0, b >= 0, c >= 0, d >= 0
689 }
690 }
691 }
692 else
693 {
694 if (c < 0)
695 {
696 if (d < 0)
697 {
698 return unsigned_min_xor(a, b, c, d); // a >= 0, b >= 0, c < 0, d < 0
699 }
700 else
701 {
702 return unsigned_min_xor(a, b, c, -1); // a >= 0, b >= 0, c < 0, d >= 0
703 }
704 }
705 else
706 {
707 return unsigned_min_xor(a, b, c, d); // a >= 0, b >= 0, c >= 0, d >= 0
708 }
709 }
710}
711
721{
722 return ~a;
723}
724
734{
735 return ~b;
736}
737
749{
750 if (b >= 0)
751 return b << d;
752 else
753 return b << c;
754}
755
767{
768 if (a >= 0)
769 return a << c;
770 else
771 return a << d;
772}
773
785{
786 if (b >= 0)
787 return b >> c;
788 else
789 return b >> d;
790}
791
803{
804 if (a >= 0)
805 return a >> d;
806 else
807 return a >> c;
808}
809
818{
819 // isolate the sign bit of the truncated output
820 UINT_X sign_bit = 1 << (n - 1);
821
822 // set the n least significant bits to one
823 UINT_X mask = sign_bit | (sign_bit - 1);
824
825 // if the input is positive, just truncate and cast
826 if ((x & sign_bit) == 0)
827 return (INT_X)x & mask;
828
829 // if the input is negative, convert it to positive with relation -x = (~x) +
830 // 1, truncate it, cast it to signed integer and return the negative result
831 INT_X positive_x = (~x & mask) + 1;
832 return -positive_x;
833}
834
845{
846 // isolate the sign bit of the truncated output
847 UINT_X sign_bit = 1 << (n - 1);
848
849 // keep the bits of the upper bound that are at least as significant
850 // as the sign bit of the truncated output
851 // e.g. b = 0b01101010 and n = 4 yields cand_bits = 0b01101000
852 UINT_X cand_bits = b & (-sign_bit);
853
854 // isolate the least significant candidate bit
855 // e.g. cand_bits = 0b01101010 yields least_bit = 0b00000010
856 UINT_X least_bit = cand_bits & (-cand_bits);
857
858 // reduce b by removing least_bit and activating all the less significant ones
859 // e.g. b = 0b00101100 and least_bit = 0b00001000 yields alternate_b =
860 // 0b00100111
861 UINT_X alternate_b = (b - least_bit) | (least_bit - 1);
862
863 // reduce b further by setting the sign bit to zero
864 // this operation ensures that the result is positive
865 UINT_X positive_b = alternate_b & ~sign_bit;
866
867 // check if the reduced positive b still belongs to the input interval
868 if (positive_b >= a && positive_b <= b)
869 return unsigned_2_signed(positive_b, n);
870
871 // otherwise, try to use the upper bound (if positive)
872 if ((b & sign_bit) == 0)
873 return unsigned_2_signed(b, n);
874
875 // if we are forced to return a negative number, try to maximize it
876 if (alternate_b >= a && alternate_b <= b)
877 return unsigned_2_signed(alternate_b, n);
878
879 // otherwise, just use the negative upper bound
880 return unsigned_2_signed(b, n);
881}
882
893{
894 // isolate the sign bit of the truncated output
895 UINT_X sign_bit = 1 << (n - 1);
896
897 // flip the bits of the upper bound that are at least as significant
898 // as the sign bit of the truncated output
899 // e.g. a = 0b01100010 and n = 4 yields cand_bits = 0b10011000
900 UINT_X cand_bits = ~a & (-sign_bit);
901
902 // isolate the least significant candidate bit
903 // e.g. cand_bits = 0b01101010 yields least_bit = 0b00000010
904 UINT_X least_bit = cand_bits & (-cand_bits);
905
906 // increase a by adding least_bit and removing all the less significant ones
907 // e.g. a = 0b00110100 and least_bit = 0b00001000 yields alternate_a =
908 // 0b00111000
909 UINT_X alternate_a = (a | least_bit) & (-least_bit);
910
911 // increase a further by setting the sign bit to one
912 // this operation ensures that the result is positive
913 UINT_X negative_a = alternate_a | sign_bit;
914
915 // check if the increased negative a still belongs to the input interval
916 if (negative_a >= a && negative_a <= b)
917 return unsigned_2_signed(negative_a, n);
918
919 // otherwise, try to use the lower bound (if negative)
920 if ((a & sign_bit) != 0)
921 return unsigned_2_signed(a, n);
922
923 // if we are forced to return a positive number, try to minimise it
924 if (alternate_a >= a && alternate_a <= b)
925 return unsigned_2_signed(alternate_a, n);
926
927 // otherwise, just use the upper bound
928 return unsigned_2_signed(a, n);
929}
930
941{
942 // if the input interval contains zero, split it
943 if (a < 0 && b >= 0)
944 {
947 return (c > d) ? c : d;
948 }
949
950 // otherwise interpret [a,b] as an unsigned interval
951 return unsigned_2_signed_max_truncate(a, b, n);
952}
953
964{
965 // if the input interval contains zero, split it
966 if (a < 0 && b >= 0)
967 {
970 return (c < d) ? c : d;
971 }
972
973 // otherwise interpret [a,b] as an unsigned interval
974 return unsigned_2_signed_min_truncate(a, b, n);
975}
976
987{
988 // isolate the sign bit of the input
989 UINT_X sign_bit = 1 << (n - 1);
990
991 // if a > 0 and b <= 0, return the largest positive number
992 if ((b & sign_bit) != 0)
993 {
994 if ((a & sign_bit) == 0)
995 return sign_bit - 1;
996
997 // if both a <= 0 and b <= 0, extend the sign of the upper bound
998 return unsigned_2_signed(b, n);
999 }
1000
1001 // otherwise, keep the positive upper bound
1002 return b;
1003}
1004
1015{
1016 // isolate the sign bit of the input
1017 UINT_X sign_bit = 1 << (n - 1);
1018
1019 // if a > 0 and b <= 0, return the smallest negative number
1020 if ((b & sign_bit) != 0)
1021 {
1022 if ((a & sign_bit) == 0)
1023 return unsigned_2_signed(sign_bit, n);
1024
1025 // if both a <= 0 and b <= 0, extend the sign of the lower bound
1026 return unsigned_2_signed(a, n);
1027 }
1028
1029 // otherwise, keep the positive lower bound
1030 return a;
1031}
1032
1033#define UINT_FUNC(FUNC, LHS, RHS) \
1034 FUNC( \
1035 LHS.get_lower().to_uint64(), \
1036 LHS.get_upper().to_uint64(), \
1037 RHS.get_lower().to_uint64(), \
1038 RHS.get_upper().to_uint64())
1039
1040#define INT_FUNC(FUNC, LHS, RHS) \
1041 FUNC( \
1042 LHS.get_lower().to_int64(), \
1043 LHS.get_upper().to_int64(), \
1044 RHS.get_lower().to_int64(), \
1045 RHS.get_upper().to_int64())
1046
1047#define GET_BIT_INTERVALS(NAME, MIN_UFUNC, MAX_UFUNC, MIN_FUNC, MAX_FUNC) \
1048 template <> \
1049 interval_templatet<BigInt> interval_templatet<BigInt>::NAME( \
1050 const interval_templatet<BigInt> &lhs, \
1051 const interval_templatet<BigInt> &rhs) const \
1052 { \
1053 interval_templatet<BigInt> result; \
1054 if (!lhs.lower || !lhs.upper || !rhs.lower || !rhs.upper) \
1055 return result; \
1056 if (is_unsignedbv_type(lhs.type) && is_unsignedbv_type(rhs.type)) \
1057 { \
1058 result.set_lower(UINT_FUNC(MIN_UFUNC, lhs, rhs)); \
1059 result.set_upper(UINT_FUNC(MAX_UFUNC, lhs, rhs)); \
1060 } \
1061 else if (is_signedbv_type(lhs.type) && is_signedbv_type(rhs.type)) \
1062 { \
1063 result.set_lower(INT_FUNC(MIN_FUNC, lhs, rhs)); \
1064 result.set_upper(INT_FUNC(MAX_FUNC, lhs, rhs)); \
1065 } \
1066 return result; \
1067 }
1068
1069#include <big-int/bigint.hh>
1070
1072 interval_bitand,
1077
1079 interval_bitor,
1084
1086 interval_bitxor,
1091
1093 interval_logical_right_shift,
1098
1099template <>
1102 const interval_templatet<BigInt> &lhs,
1103 const interval_templatet<BigInt> &rhs) const
1104{
1106 if (!lhs.lower || !lhs.upper || !rhs.lower || !rhs.upper)
1107 return result;
1108 if (!is_signedbv_type(lhs.type) || !is_signedbv_type(rhs.type))
1109 return result;
1110
1111 if (rhs.get_lower() < 0 || rhs.get_upper() >= BigInt(lhs.type->get_width()))
1112 return result;
1113 result.set_lower(INT_FUNC(signed_min_right_shift, lhs, rhs));
1114 result.set_upper(INT_FUNC(signed_max_right_shift, lhs, rhs));
1115 return result;
1116}
1117
1119 interval_left_shift,
1124
1125#undef UINT_FUNC
1126#undef INT_FUNC
1127#undef GET_BIT_INTERVALS
1128
1129#endif // BITWISE_BOUNDS_H_INCLUDED
INT_X unsigned_2_signed_max_truncate(UINT_X a, UINT_X b, UINT_X n)
Upper bound on unsigned to signed interval truncation.
Definition bitwise_bounds.h:844
#define UINT_X
Definition bitwise_bounds.h:4
UINT_X unsigned_min_left_shift(UINT_X a, UINT_X, UINT_X c, UINT_X)
Lower bound on interval left shift.
Definition bitwise_bounds.h:225
UINT_X unsigned_max_left_shift(UINT_X, UINT_X b, UINT_X, UINT_X d)
Upper bound on interval left shift.
Definition bitwise_bounds.h:211
UINT_X unsigned_min_not(UINT_X, UINT_X b)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:197
unsigned_max_or
Definition bitwise_bounds.h:1081
signed_max_or signed_min_right_shift
Definition bitwise_bounds.h:1096
signed_max_or unsigned_max_right_shift
Definition bitwise_bounds.h:1095
UINT_X signed_2_unsigned_max_extend(INT_X a, INT_X b, UINT_X n)
Upper bound on the unsigned extension of an n bit signed interval.
Definition bitwise_bounds.h:345
INT_X signed_max_and(INT_X a, INT_X b, INT_X c, INT_X d)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:541
#define INT_FUNC(FUNC, LHS, RHS)
Definition bitwise_bounds.h:1040
INT_X signed_min_not(INT_X, INT_X b)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:733
UINT_X signed_2_unsigned_min_extend(INT_X a, INT_X b, UINT_X n)
Lower bound on the unsigned extension of an n bit signed interval.
Definition bitwise_bounds.h:370
INT_X signed_max_not(INT_X a, INT_X)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:720
unsigned_min_or
Definition bitwise_bounds.h:1080
UINT_X unsigned_max_and(UINT_X a, UINT_X b, UINT_X c, UINT_X d)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:125
INT_X signed_max_right_shift(INT_X, INT_X b, UINT_X c, UINT_X d)
Upper bound on interval right shift.
Definition bitwise_bounds.h:784
INT_X signed_2_signed_min_truncate(INT_X a, INT_X b, UINT_X n)
Lower bound on signed to signed interval truncation.
Definition bitwise_bounds.h:963
UINT_X signed_2_unsigned_min_truncate(INT_X a, INT_X b, UINT_X n)
Lower bound on signed to unsigned interval truncation.
Definition bitwise_bounds.h:325
UINT_X signed_2_unsigned_max_truncate(INT_X a, INT_X b, UINT_X n)
Upper bound on signed to unsigned interval truncation.
Definition bitwise_bounds.h:305
INT_X unsigned_2_signed(UINT_X x, UINT_X n)
Cast a limited-width unsigned integer to signed integer.
Definition bitwise_bounds.h:817
INT_X signed_2_signed_max_truncate(INT_X a, INT_X b, UINT_X n)
Upper bound on signed to signed interval truncation.
Definition bitwise_bounds.h:940
INT_X unsigned_2_signed_max_extend(UINT_X a, UINT_X b, UINT_X n)
Upper bound on the signed extension of an n bit unsigned interval.
Definition bitwise_bounds.h:986
UINT_X unsigned_min_xor(UINT_X a, UINT_X b, UINT_X c, UINT_X d)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:171
signed_max_or unsigned_min_right_shift
Definition bitwise_bounds.h:1094
UINT_X unsigned_max_not(UINT_X a, UINT_X)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:184
UINT_X unsigned_2_unsigned_min_truncate(UINT_X a, UINT_X b, UINT_X n)
Lower bound on unsigned to unsigned interval truncation.
Definition bitwise_bounds.h:286
UINT_X unsigned_max_xor(UINT_X a, UINT_X b, UINT_X c, UINT_X d)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:155
#define GET_BIT_INTERVALS(NAME, MIN_UFUNC, MAX_UFUNC, MIN_FUNC, MAX_FUNC)
Definition bitwise_bounds.h:1047
#define INT_X
Definition bitwise_bounds.h:5
INT_X signed_min_and(INT_X a, INT_X b, INT_X c, INT_X d)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:557
INT_X signed_min_left_shift(INT_X a, INT_X, UINT_X c, UINT_X d)
Lower bound on interval left shift.
Definition bitwise_bounds.h:766
INT_X signed_max_or(INT_X a, INT_X b, INT_X c, INT_X d)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:397
INT_X signed_max_left_shift(INT_X, INT_X b, UINT_X c, UINT_X d)
Upper bound on interval left shift.
Definition bitwise_bounds.h:748
INT_X signed_max_xor(INT_X a, INT_X b, INT_X c, INT_X d)
Original upper bound on signed interval XOR, inspired by the case-based algorithm for signed interval...
Definition bitwise_bounds.h:574
INT_X unsigned_2_signed_min_truncate(UINT_X a, UINT_X b, UINT_X n)
Lower bound on unsigned to signed interval truncation.
Definition bitwise_bounds.h:892
INT_X unsigned_2_signed_min_extend(UINT_X a, UINT_X b, UINT_X n)
Lower bound on the signed extension of an n bit unsigned interval.
Definition bitwise_bounds.h:1014
UINT_X unsigned_min_and(UINT_X a, UINT_X b, UINT_X c, UINT_X d)
Implementation of the algorithm in Henry S.
Definition bitwise_bounds.h:140
signed_min_or
Definition bitwise_bounds.h:1082
INT_X signed_min_xor(INT_X a, INT_X b, INT_X c, INT_X d)
Original lower bound on signed interval XOR, inspired by the case-based algorithm for signed interval...
Definition bitwise_bounds.h:649
UINT_X unsigned_2_unsigned_max_truncate(UINT_X a, UINT_X b, UINT_X n)
Upper bound on unsigned to unsigned interval truncation.
Definition bitwise_bounds.h:267
Definition bigint.hh:58
This class is used to store intervals in the form of lower <= upper.
Definition interval_template.h:20
void set_lower(const T &b)
Definition interval_template.h:75
void set_upper(const T &b)
Definition interval_template.h:71
interval_templatet< BigInt > interval_arithmetic_right_shift(const interval_templatet< BigInt > &, const interval_templatet< BigInt > &) const
Definition interval_template.h:531