mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	faster CipherBlock XOR implementation for non-AVX
This commit is contained in:
		
							parent
							
								
									d034dab265
								
							
						
					
					
						commit
						a309eb9f3c
					
				
					 1 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -124,9 +124,17 @@ namespace crypto
 | 
			
		|||
			else
 | 
			
		||||
#endif
 | 
			
		||||
			{
 | 
			
		||||
				// TODO: implement it better
 | 
			
		||||
				for (int i = 0; i < 16; i++)
 | 
			
		||||
					buf[i] ^= other.buf[i];
 | 
			
		||||
				if (((size_t)buf | (size_t)other.buf) & 0x03) // multiple of 4 ?
 | 
			
		||||
				{
 | 
			
		||||
					// we are good to cast to uint32_t *
 | 
			
		||||
					for (int i = 0; i < 4; i++)
 | 
			
		||||
						((uint32_t *)buf)[i] ^= ((uint32_t *)other.buf)[i];	
 | 
			
		||||
				}	
 | 
			
		||||
				else
 | 
			
		||||
				{	
 | 
			
		||||
					for (int i = 0; i < 16; i++)
 | 
			
		||||
						buf[i] ^= other.buf[i];
 | 
			
		||||
				}	
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue