data_type
large_stringclasses
3 values
source
large_stringclasses
29 values
code
large_stringlengths
98
49.4M
filepath
large_stringlengths
5
161
message
large_stringclasses
234 values
commit
large_stringclasses
234 values
subject
large_stringclasses
418 values
critique
large_stringlengths
101
1.26M
metadata
dict
source
musl
#include <libintl.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <limits.h> static char *current_domain; char *__gettextdomain() { return current_domain ? current_domain : "messages"; } char *textdomain(const char *domainname) { if (!domainname) return __gettextdomain(); size_t domlen = s...
src/locale/textdomain.c
null
null
null
null
null
source
musl
#include "locale_impl.h" #include "pthread_impl.h" #include "libc.h" locale_t __uselocale(locale_t new) { pthread_t self = __pthread_self(); locale_t old = self->locale; locale_t global = &libc.global_locale; if (new) self->locale = new == LC_GLOBAL_LOCALE ? global : new; return old == global ? LC_GLOBAL_LOCALE...
src/locale/uselocale.c
null
null
null
null
null
source
musl
#include <wchar.h> #include <locale.h> #include "locale_impl.h" /* FIXME: stub */ int __wcscoll_l(const wchar_t *l, const wchar_t *r, locale_t locale) { return wcscmp(l, r); } int wcscoll(const wchar_t *l, const wchar_t *r) { return __wcscoll_l(l, r, CURRENT_LOCALE); } weak_alias(__wcscoll_l, wcscoll_l);
src/locale/wcscoll.c
null
null
null
null
null
source
musl
#include <wchar.h> #include <locale.h> #include "locale_impl.h" /* collate only by code points */ size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t loc) { size_t l = wcslen(src); if (l < n) { wmemcpy(dest, src, l+1); } else if (n) { wmemcpy(dest, src, n-1); dest[n-1] =...
src/locale/wcsxfrm.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <stdint.h> #include <string.h> #include <errno.h> #include "dynlink.h" static size_t mal0_clear(char *p, size_t n) { const size_t pagesz = 4096; /* arbitrary */ if (n < pagesz) return n; #ifdef __GNUC__ typedef uint64_t __attribute__((__may_alias__)) T; #else typedef unsigned char T; #...
src/malloc/calloc.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <stdint.h> #include <limits.h> #include <errno.h> #include <sys/mman.h> #include "libc.h" #include "lock.h" #include "syscall.h" #include "fork_impl.h" #define ALIGN 16 /* This function returns true if the interval [old,new] * intersects the 'len'-sized interval below &libc.auxv * (inte...
src/malloc/lite_malloc.c
null
null
null
null
null
source
musl
#define _BSD_SOURCE #include <stdlib.h> void *memalign(size_t align, size_t len) { return aligned_alloc(align, len); }
src/malloc/memalign.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <errno.h> int posix_memalign(void **res, size_t align, size_t len) { if (align < sizeof(void *)) return EINVAL; void *mem = aligned_alloc(align, len); if (!mem) return errno; *res = mem; return 0; }
src/malloc/posix_memalign.c
null
null
null
null
null
source
musl
#define _BSD_SOURCE #include <errno.h> #include <stdlib.h> void *reallocarray(void *ptr, size_t m, size_t n) { if (n && m > -1 / n) { errno = ENOMEM; return 0; } return realloc(ptr, m * n); }
src/malloc/reallocarray.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <errno.h> #include "meta.h" void *aligned_alloc(size_t align, size_t len) { if ((align & -align) != align) { errno = EINVAL; return 0; } if (len > SIZE_MAX - align || align >= (1ULL<<31)*UNIT) { errno = ENOMEM; return 0; } if (DISABLE_ALIGNED_ALLOC) { errno = ENOMEM; ret...
src/malloc/mallocng/aligned_alloc.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <stdint.h> #include <limits.h> #include <string.h> #include <sys/mman.h> #include <errno.h> #include "meta.h" static void donate(unsigned char *base, size_t len) { uintptr_t a = (uintptr_t)base; uintptr_t b = a + len; a += -a & (UNIT-1); b -= b & (UNIT-1); memset(base, 0, len); for ...
src/malloc/mallocng/donate.c
null
null
null
null
null
source
musl
#define _BSD_SOURCE #include <stdlib.h> #include <sys/mman.h> #include "meta.h" struct mapinfo { void *base; size_t len; }; static struct mapinfo nontrivial_free(struct meta *, int); static struct mapinfo free_group(struct meta *g) { struct mapinfo mi = { 0 }; int sc = g->sizeclass; if (sc < 48) { ctx.usage_...
src/malloc/mallocng/free.c
null
null
null
null
null
source
musl
#ifndef MALLOC_GLUE_H #define MALLOC_GLUE_H #include <stdint.h> #include <sys/mman.h> #include <pthread.h> #include <unistd.h> #include <elf.h> #include <string.h> #include "atomic.h" #include "syscall.h" #include "libc.h" #include "lock.h" #include "dynlink.h" // use macros to appropriately namespace these. #define ...
src/malloc/mallocng/glue.h
null
null
null
null
null
source
musl
#include <stdlib.h> #include <stdint.h> #include <limits.h> #include <string.h> #include <sys/mman.h> #include <errno.h> #include "meta.h" LOCK_OBJ_DEF; const uint16_t size_classes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 18, 20, 25, 31, 36, 42, 50, 63, 72, 84, 102, 127, 146, 170, 204, 255, 292, 340, 409,...
src/malloc/mallocng/malloc.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include "meta.h" size_t malloc_usable_size(void *p) { if (!p) return 0; struct meta *g = get_meta(p); int idx = get_slot_index(p); size_t stride = get_stride(g); unsigned char *start = g->mem->storage + stride*idx; unsigned char *end = start + stride - IB; return get_nominal_size(p, end); }
src/malloc/mallocng/malloc_usable_size.c
null
null
null
null
null
source
musl
#ifndef MALLOC_META_H #define MALLOC_META_H #include <stdint.h> #include <errno.h> #include <limits.h> #include "glue.h" __attribute__((__visibility__("hidden"))) extern const uint16_t size_classes[]; #define MMAP_THRESHOLD 131052 #define UNIT 16 #define IB 4 struct group { struct meta *meta; unsigned char activ...
src/malloc/mallocng/meta.h
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <stdlib.h> #include <sys/mman.h> #include <string.h> #include "meta.h" void *realloc(void *p, size_t n) { if (!p) return malloc(n); if (size_overflows(n)) return 0; struct meta *g = get_meta(p); int idx = get_slot_index(p); size_t stride = get_stride(g); unsigned char *start = g->me...
src/malloc/mallocng/realloc.c
null
null
null
null
null
source
musl
#include <stdlib.h> #include <stdint.h> #include <errno.h> #include "malloc_impl.h" void *aligned_alloc(size_t align, size_t len) { unsigned char *mem, *new; if ((align & -align) != align) { errno = EINVAL; return 0; } if (len > SIZE_MAX - align || (__malloc_replaced && !__aligned_alloc_replaced)) { e...
src/malloc/oldmalloc/aligned_alloc.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <stdlib.h> #include <string.h> #include <limits.h> #include <stdint.h> #include <errno.h> #include <sys/mman.h> #include "libc.h" #include "atomic.h" #include "pthread_impl.h" #include "malloc_impl.h" #include "fork_impl.h" #define malloc __libc_malloc_impl #define realloc __libc_realloc #...
src/malloc/oldmalloc/malloc.c
null
null
null
null
null
source
musl
#ifndef MALLOC_IMPL_H #define MALLOC_IMPL_H #include <sys/mman.h> #include "dynlink.h" struct chunk { size_t psize, csize; struct chunk *next, *prev; }; struct bin { volatile int lock[2]; struct chunk *head; struct chunk *tail; }; #define SIZE_ALIGN (4*sizeof(size_t)) #define SIZE_MASK (-SIZE_ALIGN) #define OV...
src/malloc/oldmalloc/malloc_impl.h
null
null
null
null
null
source
musl
#include <malloc.h> #include "malloc_impl.h" hidden void *(*const __realloc_dep)(void *, size_t) = realloc; size_t malloc_usable_size(void *p) { return p ? CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD : 0; }
src/malloc/oldmalloc/malloc_usable_size.c
null
null
null
null
null
source
musl
#include "libm.h" /* k is such that k*ln2 has minimal relative error and x - kln2 > log(DBL_MIN) */ static const int k = 2043; static const double kln2 = 0x1.62066151add8bp+10; /* exp(x)/2 for x >= log(DBL_MAX), slightly better than 0.5*exp(x/2)*exp(x/2) */ double __expo2(double x, double sign) { double scale; /* ...
src/math/__expo2.c
null
null
null
null
null
source
musl
#include "libm.h" /* k is such that k*ln2 has minimal relative error and x - kln2 > log(FLT_MIN) */ static const int k = 235; static const float kln2 = 0x1.45c778p+7f; /* expf(x)/2 for x >= log(FLT_MAX), slightly better than 0.5f*expf(x/2)*expf(x/2) */ float __expo2f(float x, float sign) { float scale; /* note tha...
src/math/__expo2f.c
null
null
null
null
null
source
musl
#include <float.h> #include "libm.h" #if LDBL_MANT_DIG != DBL_MANT_DIG long double __math_invalidl(long double x) { return (x - x) / (x - x); } #endif
src/math/__math_invalidl.c
null
null
null
null
null
source
musl
/* origin: FreeBSD /usr/src/lib/msun/src/e_rem_pio2.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is f...
src/math/__rem_pio2.c
null
null
null
null
null
source
musl
/* origin: FreeBSD /usr/src/lib/msun/src/e_rem_pio2f.c */ /* * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. * Debugged and optimized by Bruce D. Evans. */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * ...
src/math/__rem_pio2f.c
null
null
null
null
null
source
musl
/* origin: FreeBSD /usr/src/lib/msun/ld80/e_rem_pio2.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans. * * Developed at SunSoft, a Sun Microsystems, Inc. business. ...
src/math/__rem_pio2l.c
null
null
null
null
null
source
musl
#include "libm.h" #if FLT_EVAL_METHOD==2 #undef sqrtf #define sqrtf sqrtl #elif FLT_EVAL_METHOD==1 #undef sqrtf #define sqrtf sqrt #endif /* acosh(x) = log(x + sqrt(x*x-1)) */ float acoshf(float x) { union {float f; uint32_t i;} u = {x}; uint32_t a = u.i & 0x7fffffff; if (a < 0x3f800000+(1<<23)) /* |x| < 2, inv...
src/math/acoshf.c
null
null
null
null
null
source
musl
#include "libm.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double acoshl(long double x) { return acosh(x); } #elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 /* acosh(x) = log(x + sqrt(x*x-1)) */ long double acoshl(long double x) { union ldshape u = {x}; int e = u.i.se; if (e < 0x3fff + 1) /* 0 <=...
src/math/acoshl.c
null
null
null
null
null
source
musl
#include "libm.h" /* cosh(x) = (exp(x) + 1/exp(x))/2 * = 1 + 0.5*(exp(x)-1)*(exp(x)-1)/exp(x) * = 1 + x*x/2 + o(x^4) */ double cosh(double x) { union {double f; uint64_t i;} u = {.f = x}; uint32_t w; double t; /* |x| */ u.i &= (uint64_t)-1/2; x = u.f; w = u.i >> 32; /* |x| < log(2) */ if ...
src/math/cosh.c
null
null
null
null
null
source
musl
#include "libm.h" float coshf(float x) { union {float f; uint32_t i;} u = {.f = x}; uint32_t w; float t; /* |x| */ u.i &= 0x7fffffff; x = u.f; w = u.i; /* |x| < log(2) */ if (w < 0x3f317217) { if (w < 0x3f800000 - (12<<23)) { FORCE_EVAL(x + 0x1p120f); return 1; } t = expm1f(x); return 1 + t*t/...
src/math/coshf.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <math.h> #include <stdint.h> double exp10(double x) { static const double p10[] = { 1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15 }; double n, y =...
src/math/exp10.c
null
null
null
null
null
source
musl
#define _GNU_SOURCE #include <math.h> #include <stdint.h> float exp10f(float x) { static const float p10[] = { 1e-7f, 1e-6f, 1e-5f, 1e-4f, 1e-3f, 1e-2f, 1e-1f, 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7 }; float n, y = modff(x, &n); union {float f; uint32_t i;} u = {n}; /* fabsf(n) < 8 without raising invalid on na...
src/math/exp10f.c
null
null
null
null
null
source
musl
/* origin: FreeBSD /usr/src/lib/msun/src/s_expm1f.c */ /* * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. bu...
src/math/expm1f.c
null
null
null
null
null
source
musl
#include <stdint.h> #include <float.h> #include <math.h> #include "atomic.h" #define ASUINT64(x) ((union {double f; uint64_t i;}){x}).i #define ZEROINFNAN (0x7ff-0x3ff-52-1) struct num { uint64_t m; int e; int sign; }; static struct num normalize(double x) { uint64_t ix = ASUINT64(x); int e = ix>>52; int sign = e...
src/math/fma.c
null
null
null
null
null
source
musl
/* origin: FreeBSD /usr/src/lib/msun/src/s_fmaf.c */ /*- * Copyright (c) 2005-2011 David Schultz <das@FreeBSD.ORG> * All rights reserved. * * are met: * notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer in the * documentation and...
src/math/fmaf.c
null
null
null
null
null
source
musl
/* * Single-precision log function. * * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include <math.h> #include <stdint.h> #include "libm.h" #include "logf_data.h" /* LOGF_TABLE_BITS = 4 LOGF_POLY_ORDER = 4 ULP error: 0.818 (nearest rounding.) Relative error: 1.957 * 2^-26 (before rou...
src/math/logf.c
null
null
null
null
null
source
musl
/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_powl.c */ /* * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice a...
src/math/powl.c
null
null
null
null
null
source
musl
#include <math.h> double remainder(double x, double y) { int q; return remquo(x, y, &q); } weak_alias(remainder, drem);
src/math/remainder.c
null
null
null
null
null
source
musl
#include <math.h> float remainderf(float x, float y) { int q; return remquof(x, y, &q); } weak_alias(remainderf, dremf);
src/math/remainderf.c
null
null
null
null
null
source
musl
#include "libm.h" /* sinh(x) = (exp(x) - 1/exp(x))/2 * = (exp(x)-1 + (exp(x)-1)/exp(x))/2 * = x + x^3/6 + o(x^5) */ double sinh(double x) { union {double f; uint64_t i;} u = {.f = x}; uint32_t w; double t, h, absx; h = 0.5; if (u.i >> 63) h = -h; /* |x| */ u.i &= (uint64_t)-1/2; absx = u....
src/math/sinh.c
null
null
null
null
null
source
musl
#include "libm.h" float sinhf(float x) { union {float f; uint32_t i;} u = {.f = x}; uint32_t w; float t, h, absx; h = 0.5; if (u.i >> 31) h = -h; /* |x| */ u.i &= 0x7fffffff; absx = u.f; w = u.i; /* |x| < log(FLT_MAX) */ if (w < 0x42b17217) { t = expm1f(absx); if (w < 0x3f800000) { if (w < 0x3f80...
src/math/sinhf.c
null
null
null
null
null
source
musl
#include <stdint.h> #include <math.h> #include "libm.h" #include "sqrt_data.h" #define FENV_SUPPORT 1 /* returns a*b*2^-32 - e, with error 0 <= e < 1. */ static inline uint32_t mul32(uint32_t a, uint32_t b) { return (uint64_t)a*b >> 32; } /* returns a*b*2^-64 - e, with error 0 <= e < 3. */ static inline uint64_t ...
src/math/sqrt.c
null
null
null
null
null
source
musl
#include "sqrt_data.h" const uint16_t __rsqrt_tab[128] = { 0xb451,0xb2f0,0xb196,0xb044,0xaef9,0xadb6,0xac79,0xab43, 0xaa14,0xa8eb,0xa7c8,0xa6aa,0xa592,0xa480,0xa373,0xa26b, 0xa168,0xa06a,0x9f70,0x9e7b,0x9d8a,0x9c9d,0x9bb5,0x9ad1, 0x99f0,0x9913,0x983a,0x9765,0x9693,0x95c4,0x94f8,0x9430, 0x936b,0x92a9,0x91ea,0x912e,0x907...
src/math/sqrt_data.c
null
null
null
null
null
source
musl
#ifndef _SQRT_DATA_H #define _SQRT_DATA_H #include <features.h> #include <stdint.h> /* if x in [1,2): i = (int)(64*x); if x in [2,4): i = (int)(32*x-64); __rsqrt_tab[i]*2^-16 is estimating 1/sqrt(x) with small relative error: |__rsqrt_tab[i]*0x1p-16*sqrt(x) - 1| < -0x1.fdp-9 < 2^-8 */ extern hidden const uin...
src/math/sqrt_data.h
null
null
null
null
null
source
musl
#include <stdint.h> #include <math.h> #include "libm.h" #include "sqrt_data.h" #define FENV_SUPPORT 1 static inline uint32_t mul32(uint32_t a, uint32_t b) { return (uint64_t)a*b >> 32; } /* see sqrt.c for more detailed comments. */ float sqrtf(float x) { uint32_t ix, m, m1, m0, even, ey; ix = asuint(x); if (p...
src/math/sqrtf.c
null
null
null
null
null
source
musl
#include <stdint.h> #include <math.h> #include <float.h> #include "libm.h" #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double sqrtl(long double x) { return sqrt(x); } #elif (LDBL_MANT_DIG == 113 || LDBL_MANT_DIG == 64) && LDBL_MAX_EXP == 16384 #include "sqrt_data.h" #define FENV_SUPPORT 1 typedef struct { ...
src/math/sqrtl.c
null
null
null
null
null
source
musl
#include <math.h> #if __ARM_PCS_VFP && __ARM_FP&8 double fabs(double x) { __asm__ ("vabs.f64 %P0, %P1" : "=w"(x) : "w"(x)); return x; } #else #include "../fabs.c" #endif
src/math/arm/fabs.c
null
null
null
null
null
source
musl
#include <math.h> #if (__ARM_PCS_VFP || (__VFP_FP__ && !__SOFTFP__)) && (__ARM_FP&8) double sqrt(double x) { __asm__ ("vsqrt.f64 %P0, %P1" : "=w"(x) : "w"(x)); return x; } #else #include "../sqrt.c" #endif
src/math/arm/sqrt.c
null
null
null
null
null
source
musl
# use acos(x) = atan2(fabs(sqrt((1-x)*(1+x))), x) .global acos .type acos,@function acos: fldl 4(%esp) fld %st(0) fld1 fsub %st(0),%st(1) fadd %st(2) fmulp fsqrt fabs # fix sign of zero (matters in downward rounding mode) fxch %st(1) fpatan fstpl 4(%esp) fldl 4(%esp) ret
src/math/i386/acos.s
null
null
null
null
null
source
musl
.global acosf .type acosf,@function acosf: flds 4(%esp) fld %st(0) fld1 fsub %st(0),%st(1) fadd %st(2) fmulp fsqrt fabs # fix sign of zero (matters in downward rounding mode) fxch %st(1) fpatan fstps 4(%esp) flds 4(%esp) ret
src/math/i386/acosf.s
null
null
null
null
null
source
musl
.global acosl .type acosl,@function acosl: fldt 4(%esp) fld %st(0) fld1 fsub %st(0),%st(1) fadd %st(2) fmulp fsqrt fabs # fix sign of zero (matters in downward rounding mode) fxch %st(1) fpatan ret
src/math/i386/acosl.s
null
null
null
null
null
source
musl
.global asin .type asin,@function asin: fldl 4(%esp) mov 8(%esp),%eax add %eax,%eax cmp $0x00200000,%eax jb 1f fld %st(0) fld1 fsub %st(0),%st(1) fadd %st(2) fmulp fsqrt fpatan fstpl 4(%esp) fldl 4(%esp) ret # subnormal x, return x with underflow 1: fsts 4(%esp) ret
src/math/i386/asin.s
null
null
null
null
null
source
musl
.global asinf .type asinf,@function asinf: flds 4(%esp) mov 4(%esp),%eax add %eax,%eax cmp $0x01000000,%eax jb 1f fld %st(0) fld1 fsub %st(0),%st(1) fadd %st(2) fmulp fsqrt fpatan fstps 4(%esp) flds 4(%esp) ret # subnormal x, return x with underflow 1: fld %st(0) fmul %st(1) fstps 4(%esp) ret
src/math/i386/asinf.s
null
null
null
null
null
source
musl
.global asinl .type asinl,@function asinl: fldt 4(%esp) fld %st(0) fld1 fsub %st(0),%st(1) fadd %st(2) fmulp fsqrt fpatan ret
src/math/i386/asinl.s
null
null
null
null
null
source
musl
.global atan .type atan,@function atan: fldl 4(%esp) mov 8(%esp),%eax add %eax,%eax cmp $0x00200000,%eax jb 1f fld1 fpatan fstpl 4(%esp) fldl 4(%esp) ret # subnormal x, return x with underflow 1: fsts 4(%esp) ret
src/math/i386/atan.s
null
null
null
null
null
source
musl
.global atan2 .type atan2,@function atan2: fldl 4(%esp) fldl 12(%esp) fpatan fstpl 4(%esp) fldl 4(%esp) mov 8(%esp),%eax add %eax,%eax cmp $0x00200000,%eax jae 1f # subnormal x, return x with underflow fsts 4(%esp) 1: ret
src/math/i386/atan2.s
null
null
null
null
null
source
musl
.global atan2f .type atan2f,@function atan2f: flds 4(%esp) flds 8(%esp) fpatan fstps 4(%esp) flds 4(%esp) mov 4(%esp),%eax add %eax,%eax cmp $0x01000000,%eax jae 1f # subnormal x, return x with underflow fld %st(0) fmul %st(1) fstps 4(%esp) 1: ret
src/math/i386/atan2f.s
null
null
null
null
null
source
musl
.global atanf .type atanf,@function atanf: flds 4(%esp) mov 4(%esp),%eax add %eax,%eax cmp $0x01000000,%eax jb 1f fld1 fpatan fstps 4(%esp) flds 4(%esp) ret # subnormal x, return x with underflow 1: fld %st(0) fmul %st(1) fstps 4(%esp) ret
src/math/i386/atanf.s
null
null
null
null
null
source
musl
.global expm1l .type expm1l,@function expm1l: fldt 4(%esp) fldl2e fmulp mov $0xc2820000,%eax push %eax flds (%esp) pop %eax fucomp %st(1) fnstsw %ax sahf fld1 jb 1f # x*log2e < -65, return -1 without underflow fstp %st(1) fchs ret 1: fld %st(1) fabs fucom %st(1) fnstsw %ax fstp %st(0) fstp %st(0) ...
src/math/i386/exp_ld.s
null
null
null
null
null
source
musl
#include <math.h> double fmod(double x, double y) { unsigned short fpsr; // fprem does not introduce excess precision into x do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); while (fpsr & 0x400); return x; }
src/math/i386/fmod.c
null
null
null
null
null
source
musl
#include <math.h> float fmodf(float x, float y) { unsigned short fpsr; // fprem does not introduce excess precision into x do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); while (fpsr & 0x400); return x; }
src/math/i386/fmodf.c
null
null
null
null
null
source
musl
#include <math.h> long double fmodl(long double x, long double y) { unsigned short fpsr; do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); while (fpsr & 0x400); return x; }
src/math/i386/fmodl.c
null
null
null
null
null
source
musl
#include <math.h> long long llrint(double x) { long long r; __asm__ ("fistpll %0" : "=m"(r) : "t"(x) : "st"); return r; }
src/math/i386/llrint.c
null
null
null
null
null
source
musl
#include <math.h> long long llrintf(float x) { long long r; __asm__ ("fistpll %0" : "=m"(r) : "t"(x) : "st"); return r; }
src/math/i386/llrintf.c
null
null
null
null
null
source
musl
#include <math.h> long long llrintl(long double x) { long long r; __asm__ ("fistpll %0" : "=m"(r) : "t"(x) : "st"); return r; }
src/math/i386/llrintl.c
null
null
null
null
null
source
musl
.global log .type log,@function log: fldln2 fldl 4(%esp) fyl2x fstpl 4(%esp) fldl 4(%esp) ret
src/math/i386/log.s
null
null
null
null
null
source
musl
.global log10 .type log10,@function log10: fldlg2 fldl 4(%esp) fyl2x fstpl 4(%esp) fldl 4(%esp) ret
src/math/i386/log10.s
null
null
null
null
null
source
musl
.global log10f .type log10f,@function log10f: fldlg2 flds 4(%esp) fyl2x fstps 4(%esp) flds 4(%esp) ret
src/math/i386/log10f.s
null
null
null
null
null
source
musl
.global log1p .type log1p,@function log1p: mov 8(%esp),%eax fldln2 and $0x7fffffff,%eax fldl 4(%esp) cmp $0x3fd28f00,%eax ja 1f cmp $0x00100000,%eax jb 2f fyl2xp1 fstpl 4(%esp) fldl 4(%esp) ret 1: fld1 faddp fyl2x fstpl 4(%esp) fldl 4(%esp) ret # subnormal x, return x with underflow 2: fsts 4(%esp) ...
src/math/i386/log1p.s
null
null
null
null
null
source
musl
.global log1pf .type log1pf,@function log1pf: mov 4(%esp),%eax fldln2 and $0x7fffffff,%eax flds 4(%esp) cmp $0x3e940000,%eax ja 1f cmp $0x00800000,%eax jb 2f fyl2xp1 fstps 4(%esp) flds 4(%esp) ret 1: fld1 faddp fyl2x fstps 4(%esp) flds 4(%esp) ret # subnormal x, return x with underflow 2: fxch fmul ...
src/math/i386/log1pf.s
null
null
null
null
null
source
musl
.global log2 .type log2,@function log2: fld1 fldl 4(%esp) fyl2x fstpl 4(%esp) fldl 4(%esp) ret
src/math/i386/log2.s
null
null
null
null
null
source
musl
.global log2f .type log2f,@function log2f: fld1 flds 4(%esp) fyl2x fstps 4(%esp) flds 4(%esp) ret
src/math/i386/log2f.s
null
null
null
null
null
source
musl
.global logf .type logf,@function logf: fldln2 flds 4(%esp) fyl2x fstps 4(%esp) flds 4(%esp) ret
src/math/i386/logf.s
null
null
null
null
null
source
musl
#include <math.h> long lrint(double x) { long r; __asm__ ("fistpl %0" : "=m"(r) : "t"(x) : "st"); return r; }
src/math/i386/lrint.c
null
null
null
null
null
source
musl
#include <math.h> long lrintf(float x) { long r; __asm__ ("fistpl %0" : "=m"(r) : "t"(x) : "st"); return r; }
src/math/i386/lrintf.c
null
null
null
null
null
source
musl
#include <math.h> long lrintl(long double x) { long r; __asm__ ("fistpl %0" : "=m"(r) : "t"(x) : "st"); return r; }
src/math/i386/lrintl.c
null
null
null
null
null
source
musl
#include <math.h> double remainder(double x, double y) { unsigned short fpsr; // fprem1 does not introduce excess precision into x do __asm__ ("fprem1; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); while (fpsr & 0x400); return x; } weak_alias(remainder, drem);
src/math/i386/remainder.c
null
null
null
null
null
source
musl
#include <math.h> float remainderf(float x, float y) { unsigned short fpsr; // fprem1 does not introduce excess precision into x do __asm__ ("fprem1; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); while (fpsr & 0x400); return x; } weak_alias(remainderf, dremf);
src/math/i386/remainderf.c
null
null
null
null
null
source
musl
#include <math.h> long double remainderl(long double x, long double y) { unsigned short fpsr; do __asm__ ("fprem1; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); while (fpsr & 0x400); return x; }
src/math/i386/remainderl.c
null
null
null
null
null
source
musl
#include "libm.h" double sqrt(double x) { union ldshape ux; unsigned fpsr; __asm__ ("fsqrt; fnstsw %%ax": "=t"(ux.f), "=a"(fpsr) : "0"(x)); if ((ux.i.m & 0x7ff) != 0x400) return (double)ux.f; /* Rounding to double would have encountered an exact halfway case. Adjust mantissa downwards if fsqrt rounded up, e...
src/math/i386/sqrt.c
null
null
null
null
null
source
musl
#include <math.h> float sqrtf(float x) { long double t; /* The long double result has sufficient precision so that * second rounding to float still keeps the returned value * correctly rounded, see Pierre Roux, "Innocuous Double * Rounding of Basic Arithmetic Operations". */ __asm__ ("fsqrt" : "=t"(t) : "0"(x...
src/math/i386/sqrtf.c
null
null
null
null
null
source
musl
#include <math.h> #if __HAVE_68881__ long double sqrtl(long double x) { __asm__ ("fsqrt.x %1,%0" : "=f"(x) : "fm"(x)); return x; } #else #include "../sqrtl.c" #endif
src/math/m68k/sqrtl.c
null
null
null
null
null
source
musl
#if !defined(__mips_soft_float) && defined(__mips_abs2008) #include <math.h> double fabs(double x) { double r; __asm__("abs.d %0,%1" : "=f"(r) : "f"(x)); return r; } #else #include "../fabs.c" #endif
src/math/mips/fabs.c
null
null
null
null
null
source
musl
#if !defined(__mips_soft_float) && defined(__mips_abs2008) #include <math.h> float fabsf(float x) { float r; __asm__("abs.s %0,%1" : "=f"(r) : "f"(x)); return r; } #else #include "../fabsf.c" #endif
src/math/mips/fabsf.c
null
null
null
null
null
source
musl
#if !defined(__mips_soft_float) && __mips >= 3 #include <math.h> double sqrt(double x) { double r; __asm__("sqrt.d %0,%1" : "=f"(r) : "f"(x)); return r; } #else #include "../sqrt.c" #endif
src/math/mips/sqrt.c
null
null
null
null
null
source
musl
#if !defined(__mips_soft_float) && __mips >= 2 #include <math.h> float sqrtf(float x) { float r; __asm__("sqrt.s %0,%1" : "=f"(r) : "f"(x)); return r; } #else #include "../sqrtf.c" #endif
src/math/mips/sqrtf.c
null
null
null
null
null
source
musl
#include <math.h> #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) || defined(BROKEN_PPC_D_ASM) #include "../fabs.c" #else double fabs(double x) { __asm__ ("fabs %0, %1" : "=d"(x) : "d"(x)); return x; } #endif
src/math/powerpc/fabs.c
null
null
null
null
null
source
musl
#include <math.h> #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) #include "../fabsf.c" #else float fabsf(float x) { __asm__ ("fabs %0, %1" : "=f"(x) : "f"(x)); return x; } #endif
src/math/powerpc/fabsf.c
null
null
null
null
null
source
musl
#include <math.h> #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) || defined(BROKEN_PPC_D_ASM) #include "../fma.c" #else double fma(double x, double y, double z) { __asm__("fmadd %0, %1, %2, %3" : "=d"(x) : "d"(x), "d"(y), "d"(z)); return x; } #endif
src/math/powerpc/fma.c
null
null
null
null
null
source
musl
#include <math.h> #if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) #include "../fmaf.c" #else float fmaf(float x, float y, float z) { __asm__("fmadds %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); return x; } #endif
src/math/powerpc/fmaf.c
null
null
null
null
null
source
musl
#include <math.h> #ifdef _ARCH_PWR5X double ceil(double x) { __asm__ ("frip %0, %1" : "=d"(x) : "d"(x)); return x; } #else #include "../ceil.c" #endif
src/math/powerpc64/ceil.c
null
null
null
null
null
source
musl
#include <math.h> #ifdef _ARCH_PWR5X float ceilf(float x) { __asm__ ("frip %0, %1" : "=f"(x) : "f"(x)); return x; } #else #include "../ceilf.c" #endif
src/math/powerpc64/ceilf.c
null
null
null
null
null
source
musl
#include <math.h> double fabs(double x) { __asm__ ("fabs %0, %1" : "=d"(x) : "d"(x)); return x; }
src/math/powerpc64/fabs.c
null
null
null
null
null
source
musl
#include <math.h> float fabsf(float x) { __asm__ ("fabs %0, %1" : "=f"(x) : "f"(x)); return x; }
src/math/powerpc64/fabsf.c
null
null
null
null
null
source
musl
#include <math.h> #ifdef _ARCH_PWR5X double floor(double x) { __asm__ ("frim %0, %1" : "=d"(x) : "d"(x)); return x; } #else #include "../floor.c" #endif
src/math/powerpc64/floor.c
null
null
null
null
null
source
musl
#include <math.h> #ifdef _ARCH_PWR5X float floorf(float x) { __asm__ ("frim %0, %1" : "=f"(x) : "f"(x)); return x; } #else #include "../floorf.c" #endif
src/math/powerpc64/floorf.c
null
null
null
null
null
source
musl
#include <math.h> double fma(double x, double y, double z) { __asm__ ("fmadd %0, %1, %2, %3" : "=d"(x) : "d"(x), "d"(y), "d"(z)); return x; }
src/math/powerpc64/fma.c
null
null
null
null
null
source
musl
#include <math.h> float fmaf(float x, float y, float z) { __asm__ ("fmadds %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); return x; }
src/math/powerpc64/fmaf.c
null
null
null
null
null
source
musl
#include <math.h> #ifdef __VSX__ double fmax(double x, double y) { __asm__ ("xsmaxdp %x0, %x1, %x2" : "=ws"(x) : "ws"(x), "ws"(y)); return x; } #else #include "../fmax.c" #endif
src/math/powerpc64/fmax.c
null
null
null
null
null