mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pod: parser: avoid unneeded integer division
SPA_POD_CHOICE_N_VALUES involves an integer division, which is slow. Replace it with subtraction and comparison. No functional change intended.
This commit is contained in:
		
							parent
							
								
									da1d4fb30c
								
							
						
					
					
						commit
						05bd4547d0
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -286,7 +286,8 @@ SPA_API_POD_PARSER bool spa_pod_parser_can_collect(const struct spa_pod *pod, ch
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		if (SPA_POD_CHOICE_TYPE(pod) != SPA_CHOICE_None)
 | 
							if (SPA_POD_CHOICE_TYPE(pod) != SPA_CHOICE_None)
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		if (SPA_POD_CHOICE_N_VALUES(pod) < 1)
 | 
							if (pod->size - sizeof(struct spa_pod_choice_body) <
 | 
				
			||||||
 | 
									SPA_POD_CHOICE_VALUE_SIZE(pod))
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		pod = SPA_POD_CHOICE_CHILD(pod);
 | 
							pod = SPA_POD_CHOICE_CHILD(pod);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue