mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	fmt-ops: fix test for big endian
This commit is contained in:
		
							parent
							
								
									070ca1d588
								
							
						
					
					
						commit
						7e95897a3b
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -200,8 +200,13 @@ static void test_s32_f32(void)
 | 
			
		|||
static void test_f32_s24(void)
 | 
			
		||||
{
 | 
			
		||||
	const float in[] = { 0.0f, 1.0f, -1.0f, 0.5f, -0.5f, 1.1f, -1.1f };
 | 
			
		||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
 | 
			
		||||
	const uint8_t out[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x01, 0x00, 0x80,
 | 
			
		||||
		0xff, 0xff, 0x3f, 0x01, 0x00, 0xc0, 0xff, 0xff, 0x7f, 0x01, 0x00, 0x80 };
 | 
			
		||||
#else
 | 
			
		||||
	const uint8_t out[] = { 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x80, 0x00, 0x01,
 | 
			
		||||
		0x3f, 0xff, 0xff, 0xc0, 0x00, 0x01, 0x7f, 0xff, 0xff, 0x80, 0x00, 0x01 };
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	run_test("test_f32_s24", in, sizeof(in[0]), out, 3, SPA_N_ELEMENTS(in),
 | 
			
		||||
			true, true, conv_f32_to_s24_c);
 | 
			
		||||
| 
						 | 
				
			
			@ -215,8 +220,13 @@ static void test_f32_s24(void)
 | 
			
		|||
 | 
			
		||||
static void test_s24_f32(void)
 | 
			
		||||
{
 | 
			
		||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
 | 
			
		||||
	const uint8_t in[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x01, 0x00, 0x80,
 | 
			
		||||
		0xff, 0xff, 0x3f, 0x01, 0x00, 0xc0,  };
 | 
			
		||||
#else
 | 
			
		||||
	const uint8_t in[] = { 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x80, 0x00, 0x01,
 | 
			
		||||
		0x3f, 0xff, 0xff, 0xc0, 0x00, 0x01,  };
 | 
			
		||||
#endif
 | 
			
		||||
	const float out[] = { 0.0f, 1.0f, -1.0f, 0.4999999404f, -0.4999999404f, };
 | 
			
		||||
 | 
			
		||||
	run_test("test_s24_f32d", in, 3, out, sizeof(out[0]), SPA_N_ELEMENTS(out),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue