@@ -149,21 +149,21 @@ class Bundle
149149class BundleView
150150{
151151 public:
152- BundleView (Net net) : net_(net), Bundle_ (nullptr ), offset_(0 ), width_(1 ) {}
152+ BundleView (Net net) : net_(net), bundle_ (nullptr ), offset_(0 ), width_(1 ) {}
153153
154154 BundleView (const Bundle& Bundle)
155- : net_(Net::zero()), Bundle_ (&Bundle), offset_(0 ), width_(Bundle.width())
155+ : net_(Net::zero()), bundle_ (&Bundle), offset_(0 ), width_(Bundle.width())
156156 {
157157 }
158158
159159 BundleView (const Bundle& Bundle, uint32_t offset, uint32_t len)
160- : net_(Net::zero()), Bundle_ (&Bundle), offset_(offset), width_(len)
160+ : net_(Net::zero()), bundle_ (&Bundle), offset_(offset), width_(len)
161161 {
162162 }
163163
164164 // Consecutive nets starting at base.
165165 BundleView (Net base, uint32_t len)
166- : net_(base), Bundle_ (nullptr ), offset_(0 ), width_(len)
166+ : net_(base), bundle_ (nullptr ), offset_(0 ), width_(len)
167167 {
168168 }
169169
@@ -182,8 +182,8 @@ class BundleView
182182
183183 Net operator [](uint32_t i) const
184184 {
185- if (Bundle_ ) {
186- return (*Bundle_ )[offset_ + i];
185+ if (bundle_ ) {
186+ return (*bundle_ )[offset_ + i];
187187 }
188188 return Net (net_.id_ + i);
189189 }
@@ -211,8 +211,8 @@ class BundleView
211211
212212 BundleView slice (uint32_t offset, uint32_t len) const
213213 {
214- if (Bundle_ ) {
215- return BundleView (*Bundle_ , offset_ + offset, len);
214+ if (bundle_ ) {
215+ return BundleView (*bundle_ , offset_ + offset, len);
216216 }
217217 if (len == 0 ) {
218218 return BundleView (Net::zero (), nullptr , 0 , 0 );
@@ -222,14 +222,19 @@ class BundleView
222222
223223 bool isConst () const ;
224224
225+ protected:
226+ // For optimized construction of Bundle from BundleView
227+ bool isGuaranteedConsecutive () const { return bundle_ == nullptr ; }
228+ friend class Bundle ;
229+
225230 private:
226231 BundleView (Net net, const Bundle* Bundle, uint32_t offset, uint32_t len)
227- : net_(net), Bundle_ (Bundle), offset_(offset), width_(len)
232+ : net_(net), bundle_ (Bundle), offset_(offset), width_(len)
228233 {
229234 }
230235
231236 Net net_;
232- const Bundle* Bundle_ ;
237+ const Bundle* bundle_ ;
233238 uint32_t offset_;
234239 uint32_t width_;
235240};
0 commit comments