mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Added default values for hashlib at() methods
This commit is contained in:
		
							parent
							
								
									276101f032
								
							
						
					
					
						commit
						33a5b28e25
					
				
					 1 changed files with 18 additions and 0 deletions
				
			
		|  | @ -506,6 +506,15 @@ public: | |||
| 		return entries[i].udata.second; | ||||
| 	} | ||||
| 
 | ||||
| 	T at(const K &key, const T &defval) const | ||||
| 	{ | ||||
| 		int hash = do_hash(key); | ||||
| 		int i = do_lookup(key, hash); | ||||
| 		if (i < 0) | ||||
| 			return defval; | ||||
| 		return entries[i].udata.second; | ||||
| 	} | ||||
| 
 | ||||
| 	T& operator[](const K &key) | ||||
| 	{ | ||||
| 		int hash = do_hash(key); | ||||
|  | @ -896,6 +905,15 @@ public: | |||
| 		return i + offset; | ||||
| 	} | ||||
| 
 | ||||
| 	int at(const K &key, int defval) const | ||||
| 	{ | ||||
| 		int hash = database.do_hash(key); | ||||
| 		int i = database.do_lookup(key, hash); | ||||
| 		if (i < 0) | ||||
| 			return defval; | ||||
| 		return i + offset; | ||||
| 	} | ||||
| 
 | ||||
| 	int count(const K &key) const | ||||
| 	{ | ||||
| 		int hash = database.do_hash(key); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue