mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	Minor optimization to get_attribute_bool
This commit is contained in:
		
							parent
							
								
									752553d8e9
								
							
						
					
					
						commit
						6e629d2895
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -218,15 +218,19 @@ void RTLIL::AttrObject::set_bool_attribute(RTLIL::IdString id, bool value)
 | 
			
		|||
{
 | 
			
		||||
	if (value)
 | 
			
		||||
		attributes[id] = RTLIL::Const(1);
 | 
			
		||||
	else if (attributes.count(id))
 | 
			
		||||
		attributes.erase(id);
 | 
			
		||||
	else {
 | 
			
		||||
                const auto it = attributes.find(id);
 | 
			
		||||
                if (it != attributes.end())
 | 
			
		||||
			attributes.erase(it);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool RTLIL::AttrObject::get_bool_attribute(RTLIL::IdString id) const
 | 
			
		||||
{
 | 
			
		||||
	if (attributes.count(id) == 0)
 | 
			
		||||
	const auto it = attributes.find(id);
 | 
			
		||||
	if (it == attributes.end())
 | 
			
		||||
		return false;
 | 
			
		||||
	return attributes.at(id).as_bool();
 | 
			
		||||
	return it->second.as_bool();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RTLIL::AttrObject::set_strpool_attribute(RTLIL::IdString id, const pool<string> &data)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue