2 /* { dg-options "-O2" } */
4 extern "C" void abort (void);
7 typedef unsigned int uint32;
8 typedef unsigned long long uint64;
13 Tp(int, const int segment, const int index) __attribute__((noinline));
15 inline bool operator==(const Tp& other) const;
16 inline bool operator!=(const Tp& other) const;
17 int GetType() const { return type_; }
18 int GetSegment() const { return segment_; }
19 int GetIndex() const { return index_; }
21 inline static bool IsValidSegment(const int segment);
22 static const int kSegmentBits = 28;
23 static const int kTypeBits = 4;
24 static const int kMaxSegment = (1 << kSegmentBits) - 1;
30 uint32 segment_ : kSegmentBits;
31 uint32 type_ : kTypeBits;
35 uint32 type_and_segment_;
41 Tp::Tp(int t, const int segment, const int index)
42 : index_(index), segment_(segment), type_(t) {}
44 inline bool Tp::operator==(const Tp& other) const {
45 return value_ == other.value_;
47 inline bool Tp::operator!=(const Tp& other) const {
48 return value_ != other.value_;
53 inline Range(const Tp& position, const int count) __attribute__((always_inline));
54 inline Tp GetBeginTokenPosition() const;
55 inline Tp GetEndTokenPosition() const;
63 inline Range::Range(const Tp& position,
65 : position_(position), count_(count), begin_index_(0), end_index_(0)
68 inline Tp Range::GetBeginTokenPosition() const {
71 inline Tp Range::GetEndTokenPosition() const {
72 return Tp(position_.GetType(), position_.GetSegment(),
73 position_.GetIndex() + count_);
78 Range range(Tp(0, 0, 3), 0);
79 if (!(range.GetBeginTokenPosition() == Tp(0, 0, 3)))
82 if (!(range.GetEndTokenPosition() == Tp(0, 0, 3)))