this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #1636 from Niram7777/patch-1

Use built-in sqrt functions

authored by

CuriousTommy and committed by
GitHub
e688e5bf 70f433ce

+6 -7
+6 -7
src/libm/Source/Intel/xmm_sqrt.c
··· 5 5 * Created by Ian Ollmann, Ph.D. on 7/14/05. 6 6 * Copyright © 2005 Apple Computer, Inc. All rights reserved. 7 7 * 8 + * Modified by Marin Baron, on 30/11/25 9 + * As part of the Darling project. 10 + * 8 11 * This set of functions may seem a little silly at first. The compiler can generate 9 12 * sqrtsd or sqrtsf inline, so why do we need a function? It appears that people can 10 13 * make a function pointer to sqrt and call that. Therefore an implementation of sqrt() ··· 16 19 #include "math.h" 17 20 18 21 double sqrt( double x ) 19 - { 20 - xDouble f = DOUBLE_2_XDOUBLE( x ); 21 - f = _MM_SQRT_SD(f); 22 - return XDOUBLE_2_DOUBLE( f ); 22 + { 23 + return __builtin_sqrt( x ); 23 24 } 24 25 25 26 float sqrtf( float x ) 26 27 { 27 - xFloat f = FLOAT_2_XFLOAT( x ); 28 - f = _mm_sqrt_ss(f); 29 - return XFLOAT_2_FLOAT( f ); 28 + return __builtin_sqrtf( x ); 30 29 } 31 30 32 31