mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Helper: SigSpec::operator[] to accept negative indices
This commit is contained in:
		
							parent
							
								
									2f71c2c219
								
							
						
					
					
						commit
						84c7a562e5
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -734,8 +734,8 @@ public:
 | 
			
		|||
	inline int size() const { return width_; }
 | 
			
		||||
	inline bool empty() const { return width_ == 0; }
 | 
			
		||||
 | 
			
		||||
	inline RTLIL::SigBit &operator[](int index) { inline_unpack(); return bits_.at(index); }
 | 
			
		||||
	inline const RTLIL::SigBit &operator[](int index) const { inline_unpack(); return bits_.at(index); }
 | 
			
		||||
	inline RTLIL::SigBit &operator[](int index) { inline_unpack(); return index >= 0 ? bits_.at(index) : bits_.at(width_ + index); }
 | 
			
		||||
	inline const RTLIL::SigBit &operator[](int index) const { inline_unpack(); return index >= 0 ? bits_.at(index) : bits_.at(width_ + index); }
 | 
			
		||||
 | 
			
		||||
	inline RTLIL::SigSpecIterator begin() { RTLIL::SigSpecIterator it; it.sig_p = this; it.index = 0; return it; }
 | 
			
		||||
	inline RTLIL::SigSpecIterator end() { RTLIL::SigSpecIterator it; it.sig_p = this; it.index = width_; return it; }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue