code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * i...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/math.c
C
apache-2.0
22,451
// adapted from the rintf() function from musl-1.1.16 #include "libm.h" float nearbyintf(float x) { union {float f; uint32_t i;} u = {x}; int e = u.i>>23 & 0xff; int s = u.i>>31; float_t y; if (e >= 0x7f+23) return x; if (s) y = x - 0x1p23f + 0x1p23f; else y = x + 0x1p23f - 0x1p23f; if (y == 0) retur...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/nearbyintf.c
C
apache-2.0
353
/*****************************************************************************/ /*****************************************************************************/ // roundf from musl-0.9.15 /*****************************************************************************/ /****************************************************...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/roundf.c
C
apache-2.0
762
/* * This file is part of the MicroPython project, http://micropython.org/ * * These math functions are taken from newlib-nano-2, the newlib/libm/math * directory, available from https://github.com/32bitmicro/newlib-nano-2. * * Appropriate copyright headers are reproduced below. */ /* sf_cos.c -- float version ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/sf_cos.c
C
apache-2.0
1,611
/* * This file is part of the MicroPython project, http://micropython.org/ * * These math functions are taken from newlib-nano-2, the newlib/libm/math * directory, available from https://github.com/32bitmicro/newlib-nano-2. * * Appropriate copyright headers are reproduced below. */ /* sf_erf.c -- float version ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/sf_erf.c
C
apache-2.0
7,546
/* * This file is part of the MicroPython project, http://micropython.org/ * * These math functions are taken from newlib-nano-2, the newlib/libm/math * directory, available from https://github.com/32bitmicro/newlib-nano-2. * * Appropriate copyright headers are reproduced below. */ /* sf_frexp.c -- float versio...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/sf_frexp.c
C
apache-2.0
1,649
/* * This file is part of the MicroPython project, http://micropython.org/ * * These math functions are taken from newlib-nano-2, the newlib/libm/math * directory, available from https://github.com/32bitmicro/newlib-nano-2. * * Appropriate copyright headers are reproduced below. */ /* sf_ldexp.c -- float versio...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/sf_ldexp.c
C
apache-2.0
1,328
/* * This file is part of the MicroPython project, http://micropython.org/ * * These math functions are taken from newlib-nano-2, the newlib/libm/common * directory, available from https://github.com/32bitmicro/newlib-nano-2. * * Appropriate copyright headers are reproduced below. */ /* sf_modf.c -- float versi...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/sf_modf.c
C
apache-2.0
1,963
/* * This file is part of the MicroPython project, http://micropython.org/ * * These math functions are taken from newlib-nano-2, the newlib/libm/math * directory, available from https://github.com/32bitmicro/newlib-nano-2. * * Appropriate copyright headers are reproduced below. */ /* sf_sin.c -- float version ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/sf_sin.c
C
apache-2.0
1,606
/* * This file is part of the MicroPython project, http://micropython.org/ * * These math functions are taken from newlib-nano-2, the newlib/libm/math * directory, available from https://github.com/32bitmicro/newlib-nano-2. * * Appropriate copyright headers are reproduced below. */ /* sf_tan.c -- float version ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/sf_tan.c
C
apache-2.0
1,503
// an implementation of sqrtf for Thumb using hardware VFP instructions #include <math.h> float sqrtf(float x) { asm volatile ( "vsqrt.f32 %[r], %[x]\n" : [r] "=t" (x) : [x] "t" (x)); return x; }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/thumb_vfp_sqrtf.c
C
apache-2.0
244
/* * This file is part of the MicroPython project, http://micropython.org/ * * These math functions are taken from newlib-nano-2, the newlib/libm/math * directory, available from https://github.com/32bitmicro/newlib-nano-2. * * Appropriate copyright headers are reproduced below. */ /* wf_lgamma.c -- float versi...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/wf_lgamma.c
C
apache-2.0
2,302
/* * This file is part of the MicroPython project, http://micropython.org/ * * These math functions are taken from newlib-nano-2, the newlib/libm/math * directory, available from https://github.com/32bitmicro/newlib-nano-2. * * Appropriate copyright headers are reproduced below. */ /* w_gammaf.c -- float versio...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm/wf_tgamma.c
C
apache-2.0
1,727
/* origin: FreeBSD /usr/src/lib/msun/src/k_cos.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 freely...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/__cos.c
C
apache-2.0
2,884
#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 scale; /* note that k i...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/__expo2.c
C
apache-2.0
485
#include <math.h> #include <stdint.h> int __fpclassifyd(double x) { union {double f; uint64_t i;} u = {x}; int e = u.i>>52 & 0x7ff; if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; return FP_NORMAL; }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/__fpclassify.c
C
apache-2.0
259
/* 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...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/__rem_pio2.c
C
apache-2.0
4,474
/* origin: FreeBSD /usr/src/lib/msun/src/k_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...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/__rem_pio2_large.c
C
apache-2.0
16,408
#include "libm.h" int __signbitd(double x) { union { double d; uint64_t i; } y = { x }; return y.i>>63; }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/__signbit.c
C
apache-2.0
116
/* origin: FreeBSD /usr/src/lib/msun/src/k_sin.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 freely...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/__sin.c
C
apache-2.0
2,364
/* origin: FreeBSD /usr/src/lib/msun/src/k_tan.c */ /* * ==================================================== * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. * * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==========...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/__tan.c
C
apache-2.0
3,963
/* origin: FreeBSD /usr/src/lib/msun/src/e_acos.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 freel...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/acos.c
C
apache-2.0
2,933
#include "libm.h" #if FLT_EVAL_METHOD==2 #undef sqrt #define sqrt sqrtl #endif /* acosh(x) = log(x + sqrt(x*x-1)) */ double acosh(double x) { union {double f; uint64_t i;} u = {.f = x}; unsigned e = u.i >> 52 & 0x7ff; /* x < 1 domain error is handled in the called functions */ if (e < 0x3ff + 1) /* |x| < 2, u...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/acosh.c
C
apache-2.0
569
/* origin: FreeBSD /usr/src/lib/msun/src/e_asin.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 freel...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/asin.c
C
apache-2.0
3,404
#include "libm.h" /* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */ double asinh(double x) { union {double f; uint64_t i;} u = {.f = x}; unsigned e = u.i >> 52 & 0x7ff; unsigned s = u.i >> 63; /* |x| */ u.i &= (uint64_t)-1/2; x = u.f; if (e >= 0x3ff + 26) { /* |x| >= 0x1p26 or inf or nan *...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/asinh.c
C
apache-2.0
697
/* origin: FreeBSD /usr/src/lib/msun/src/s_atan.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/atan.c
C
apache-2.0
3,934
/* origin: FreeBSD /usr/src/lib/msun/src/e_atan2.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 free...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/atan2.c
C
apache-2.0
3,285
#include "libm.h" /* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */ double atanh(double x) { union {double f; uint64_t i;} u = {.f = x}; unsigned e = u.i >> 52 & 0x7ff; unsigned s = u.i >> 63; double_t y; /* |x| */ u.i &= (uint64_t)-1/2; y = u.f; if (e < 0x3ff - 1) { if (e < 0x3...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/atanh.c
C
apache-2.0
577
#include "libm.h" #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 #define EPS DBL_EPSILON #elif FLT_EVAL_METHOD==2 #define EPS LDBL_EPSILON #endif static const double_t toint = 1/EPS; double ceil(double x) { union {double f; uint64_t i;} u = {x}; int e = u.i >> 52 & 0x7ff; double_t y; if (e >= 0x3ff+52 || x == 0) ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/ceil.c
C
apache-2.0
654
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * i...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/copysign.c
C
apache-2.0
1,566
/* origin: FreeBSD /usr/src/lib/msun/src/s_cos.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/cos.c
C
apache-2.0
2,111
#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 ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/cosh.c
C
apache-2.0
764
/* origin: FreeBSD /usr/src/lib/msun/src/s_erf.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/erf.c
C
apache-2.0
10,346
/* origin: FreeBSD /usr/src/lib/msun/src/e_exp.c */ /* * ==================================================== * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. * * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ====...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/exp.c
C
apache-2.0
4,118
/* origin: FreeBSD /usr/src/lib/msun/src/s_expm1.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freel...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/expm1.c
C
apache-2.0
6,964
#include "libm.h" #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 #define EPS DBL_EPSILON #elif FLT_EVAL_METHOD==2 #define EPS LDBL_EPSILON #endif static const double_t toint = 1/EPS; double floor(double x) { union {double f; uint64_t i;} u = {x}; int e = u.i >> 52 & 0x7ff; double_t y; if (e >= 0x3ff+52 || x == 0) ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/floor.c
C
apache-2.0
653
#include <math.h> #include <stdint.h> double fmod(double x, double y) { union {double f; uint64_t i;} ux = {x}, uy = {y}; int ex = ux.i>>52 & 0x7ff; int ey = uy.i>>52 & 0x7ff; int sx = ux.i>>63; uint64_t i; /* in the followings uxi should be ux.i, but then gcc wrongly adds */ /* float load/store to inner loops...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/fmod.c
C
apache-2.0
1,270
#include <math.h> #include <stdint.h> double frexp(double x, int *e) { union { double d; uint64_t i; } y = { x }; int ee = y.i>>52 & 0x7ff; if (!ee) { if (x) { x = frexp(x*0x1p64, e); *e -= 64; } else *e = 0; return x; } else if (ee == 0x7ff) { return x; } *e = ee - 0x3fe; y.i &= 0x800ffffffffff...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/frexp.c
C
apache-2.0
374
#include <math.h> double ldexp(double x, int n) { return scalbn(x, n); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/ldexp.c
C
apache-2.0
75
#include <math.h> double __lgamma_r(double, int*); double lgamma(double x) { int sign; return __lgamma_r(x, &sign); }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/lgamma.c
C
apache-2.0
128
// Portions of this file are extracted from musl-1.1.16 src/internal/libm.h /* origin: FreeBSD /usr/src/lib/msun/src/math_private.h */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. busi...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/libm.h
C
apache-2.0
3,699
/* origin: FreeBSD /usr/src/lib/msun/src/e_log.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 freely...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/log.c
C
apache-2.0
4,026
#include <math.h> static const double _M_LN10 = 2.302585092994046; double log10(double x) { return log(x) / (double)_M_LN10; }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/log10.c
C
apache-2.0
133
/* origin: FreeBSD /usr/src/lib/msun/src/s_log1p.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freel...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/log1p.c
C
apache-2.0
3,865
#include "libm.h" double modf(double x, double *iptr) { union {double f; uint64_t i;} u = {x}; uint64_t mask; int e = (int)(u.i>>52 & 0x7ff) - 0x3ff; /* no fractional part */ if (e >= 52) { *iptr = x; if (e == 0x400 && u.i<<12 != 0) /* nan */ return x; u.i &= 1ULL<<63; return u.f; } /* no integral ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/modf.c
C
apache-2.0
536
#include <math.h> /* nearbyint is the same as rint, but it must not raise the inexact exception */ double nearbyint(double x) { #ifdef FE_INEXACT #pragma STDC FENV_ACCESS ON int e; e = fetestexcept(FE_INEXACT); #endif x = rint(x); #ifdef FE_INEXACT if (!e) feclearexcept(FE_INEXACT); #endif return x; }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/nearbyint.c
C
apache-2.0
314
/* origin: FreeBSD /usr/src/lib/msun/src/e_pow.c */ /* * ==================================================== * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. * * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ====...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/pow.c
C
apache-2.0
10,383
#include <float.h> #include <math.h> #include <stdint.h> #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 #define EPS DBL_EPSILON #elif FLT_EVAL_METHOD==2 #define EPS LDBL_EPSILON #endif static const double_t toint = 1/EPS; double rint(double x) { union {double f; uint64_t i;} u = {x}; int e = u.i>>52 & 0x7ff; int s =...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/rint.c
C
apache-2.0
489
#include "libm.h" #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 #define EPS DBL_EPSILON #elif FLT_EVAL_METHOD==2 #define EPS LDBL_EPSILON #endif static const double_t toint = 1/EPS; double round(double x) { union {double f; uint64_t i;} u = {x}; int e = u.i >> 52 & 0x7ff; double_t y; if (e >= 0x3ff+52) return x...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/round.c
C
apache-2.0
597
#include <math.h> #include <stdint.h> double scalbn(double x, int n) { union {double f; uint64_t i;} u; double_t y = x; if (n > 1023) { y *= 0x1p1023; n -= 1023; if (n > 1023) { y *= 0x1p1023; n -= 1023; if (n > 1023) n = 1023; } } else if (n < -1022) { /* make sure final n < -53 to avoid d...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/scalbn.c
C
apache-2.0
576
/* origin: FreeBSD /usr/src/lib/msun/src/s_sin.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/sin.c
C
apache-2.0
2,192
#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....
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/sinh.c
C
apache-2.0
837
/* origin: FreeBSD /usr/src/lib/msun/src/e_sqrt.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 freel...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/sqrt.c
C
apache-2.0
5,425
/* origin: FreeBSD /usr/src/lib/msun/src/s_tan.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/tan.c
C
apache-2.0
1,965
#include <math.h> double tanh(double x) { int sign = 0; if (x < 0) { sign = 1; x = -x; } x = expm1(-2 * x); x = x / (x + 2); return sign ? x : -x; }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/tanh.c
C
apache-2.0
190
/* "A Precision Approximation of the Gamma Function" - Cornelius Lanczos (1964) "Lanczos Implementation of the Gamma Function" - Paul Godfrey (2001) "An Analysis of the Lanczos Gamma Approximation" - Glendon Ralph Pugh (2004) approximation method: (x - 0.5) S(x) Gamma(x) = (x + g - 0.5...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/tgamma.c
C
apache-2.0
5,466
// an implementation of sqrt for Thumb using hardware double-precision VFP instructions double sqrt(double x) { double ret; asm volatile ( "vsqrt.f64 %P0, %P1\n" : "=w" (ret) : "w" (x)); return ret; }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/thumb_vfp_sqrt.c
C
apache-2.0
252
#include "libm.h" double trunc(double x) { union {double f; uint64_t i;} u = {x}; int e = (int)(u.i >> 52 & 0x7ff) - 0x3ff + 12; uint64_t m; if (e >= 52 + 12) return x; if (e < 12) e = 1; m = -1ULL >> e; if ((u.i & m) == 0) return x; FORCE_EVAL(x + 0x1p120f); u.i &= ~m; return u.f; }
YifuLiu/AliOS-Things
components/py_engine/engine/lib/libm_dbl/trunc.c
C
apache-2.0
303
/* * The little filesystem * * Copyright (c) 2017, Arm Limited. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause */ #include "lfs1.h" #include "lfs1_util.h" #include <inttypes.h> /// Caching block device operations /// static int lfs1_cache_read(lfs1_t *lfs1, lfs1_cache_t *rcache, const lfs1...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/littlefs/lfs1.c
C
apache-2.0
71,973
/* * The little filesystem * * Copyright (c) 2017, Arm Limited. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause */ #ifndef LFS1_H #define LFS1_H #include <stdint.h> #include <stdbool.h> #ifdef __cplusplus extern "C" { #endif /// Version info /// // Software library version // Major (top-nibble), ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/littlefs/lfs1.h
C
apache-2.0
15,814
/* * lfs1 util functions * * Copyright (c) 2017, Arm Limited. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause */ #include "lfs1_util.h" // Only compile if user does not provide custom config #ifndef LFS1_CONFIG // Software CRC implementation with small lookup table void lfs1_crc(uint32_t *restrict ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/littlefs/lfs1_util.c
C
apache-2.0
861
/* * lfs1 utility functions * * Copyright (c) 2017, Arm Limited. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause */ #ifndef LFS1_UTIL_H #define LFS1_UTIL_H // Users can override lfs1_util.h with their own configuration by defining // LFS1_CONFIG as a header file to include (-DLFS1_CONFIG=lfs1_config....
YifuLiu/AliOS-Things
components/py_engine/engine/lib/littlefs/lfs1_util.h
C
apache-2.0
5,082
/* * The little filesystem * * Copyright (c) 2017, Arm Limited. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause */ #include "lfs2.h" #include "lfs2_util.h" #define LFS2_BLOCK_NULL ((lfs2_block_t)-1) #define LFS2_BLOCK_INLINE ((lfs2_block_t)-2) /// Caching block device operations /// static inline vo...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/littlefs/lfs2.c
C
apache-2.0
163,048
/* * The little filesystem * * Copyright (c) 2017, Arm Limited. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause */ #ifndef LFS2_H #define LFS2_H #include <stdint.h> #include <stdbool.h> #include "lfs2_util.h" #ifdef __cplusplus extern "C" { #endif /// Version info /// // Software library version ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/littlefs/lfs2.h
C
apache-2.0
23,145
/* * lfs2 util functions * * Copyright (c) 2017, Arm Limited. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause */ #include "lfs2_util.h" // Only compile if user does not provide custom config #ifndef LFS2_CONFIG // Software CRC implementation with small lookup table uint32_t lfs2_crc(uint32_t crc, c...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/littlefs/lfs2_util.c
C
apache-2.0
866
/* * lfs2 utility functions * * Copyright (c) 2017, Arm Limited. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause */ #ifndef LFS2_UTIL_H #define LFS2_UTIL_H // Users can override lfs2_util.h with their own configuration by defining // LFS2_CONFIG as a header file to include (-DLFS2_CONFIG=lfs2_config....
YifuLiu/AliOS-Things
components/py_engine/engine/lib/littlefs/lfs2_util.h
C
apache-2.0
7,182
# This file is to be given as "make USER_C_MODULES=..." when building Micropython port include(${CMAKE_CURRENT_LIST_DIR}/mkrules.cmake) # lvgl bindings depend on lvgl itself, pull it in include(${LVGL_DIR}/CMakeLists.txt) # lvgl bindings target (the mpy module) add_library(usermod_lv_bindings INTERFACE) target_sourc...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/bindings.cmake
CMake
apache-2.0
805
/** * @file monitor.c * */ /********************* * INCLUDES *********************/ #include "SDL_monitor.h" #if USE_MONITOR #ifndef MONITOR_SDL_INCLUDE_PATH #define MONITOR_SDL_INCLUDE_PATH <SDL2/SDL.h> #endif #include <stdlib.h> #include <stdbool.h> #include <string.h> #include MONITOR_SDL_INCLUDE_PATH #...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/SDL/SDL_monitor.c
C
apache-2.0
5,930
/** * @file monitor.h * */ #ifndef MONITOR_H #define MONITOR_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_drv_conf.h" #else #include "lv_drv_conf.h" #endif #if USE_MONITOR #include "lvgl/src/misc/lv_color....
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/SDL/SDL_monitor.h
C
apache-2.0
899
/** * @file mouse.c * */ /********************* * INCLUDES *********************/ #include "SDL_mouse.h" #if USE_MOUSE != 0 /********************* * DEFINES *********************/ #ifndef MONITOR_ZOOM #define MONITOR_ZOOM 1 #endif /********************** * TYPEDEFS **********************/ ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/SDL/SDL_mouse.c
C
apache-2.0
2,661
/** * @file mouse.h * */ #ifndef MOUSE_H #define MOUSE_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_drv_conf.h" #else #include "lv_drv_conf.h" #endif #if USE_MOUSE #include <stdint.h> #include <stdbool.h> #incl...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/SDL/SDL_mouse.h
C
apache-2.0
1,266
/** * @file lv_drv_conf.h * */ #ifndef LV_DRV_CONF_H #define LV_DRV_CONF_H /* * COPY THIS FILE AS lv_drv_conf.h */ #if 1 /*Set it to "1" to enable the content*/ #include "../../lib/lv_bindings/lvgl/lvgl.h" /********************* * DELAY INTERFACE *********************/ #define LV_DRV_DELAY_INCLUDE <stdint.h...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/SDL/lv_drv_conf.h
C
apache-2.0
8,173
#include "../include/common.h" #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809L #endif #include <errno.h> #include <signal.h> #include <pthread.h> #include "SDL_monitor.h" #include "SDL_mouse.h" #ifdef __EMSCRIPTEN__ #include <emscripten.h> #endif /* Defines the LittlevGL tick rate in milliseconds. */ /* Increa...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/SDL/modSDL.c
C
apache-2.0
4,736
#include "../include/common.h" #include "py/obj.h" #include "py/runtime.h" #include "py/gc.h" #include "py/stackctrl.h" #include "mphalport.h" #include "espidf.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_system.h" #include "soc/cpu.h" // ESP IDF has some functions that are declared but ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/espidf.c
C
apache-2.0
6,949
/** * This file defines the Micorpython API to ESP-IDF * It is used as input to gen_mpy.py to create a micropython module **/ #if __has_include("esp_idf_version.h") # include "esp_idf_version.h" #endif // Disable some macros and includes that make pycparser choke #ifdef PYCPARSER #define __attribute__(x) #defin...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/espidf.h
C
apache-2.0
7,212
############################################################################## # # Wrapper function for backward compatibility with new ILI9XXX library. # ############################################################################## print(""" *************************************** * This library is obsoled now! * ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/ili9341.py
Python
apache-2.0
466
############################################################################## # Pure/Hybrid micropython lvgl display driver for ili9341 and ili9488 on ESP32 # # For ili9341 display: # # Build micropython with # LV_CFLAGS="-DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1" # (make parameter) to configure LVGL use the sa...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/ili9XXX.py
Python
apache-2.0
26,285
////////////////////////////////////////////////////////////////////////////// // Includes ////////////////////////////////////////////////////////////////////////////// #include "../include/common.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_system.h" #include "driver/gpio.h" #include "...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/modILI9341.c
C
apache-2.0
10,982
////////////////////////////////////////////////////////////////////////////// // Includes ////////////////////////////////////////////////////////////////////////////// // Uncomment the following line to see logs! // #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG #include "../include/common.h" #include "driver/gpio.h" #incl...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/modrtch.c
C
apache-2.0
16,236
////////////////////////////////////////////////////////////////////////////// // Includes ////////////////////////////////////////////////////////////////////////////// #include "../include/common.h" #include "lvgl/src/lv_hal/lv_hal_indev.h" #include "lvgl/src/lv_core/lv_disp.h" #include "py/obj.h" #include "py/runti...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/modxpt2046.c
C
apache-2.0
10,062
// Copyright 2017 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applic...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/sh2lib.c
C
apache-2.0
17,719
// Copyright 2017 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applic...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/sh2lib.h
C
apache-2.0
22,514
from machine import Pin import espidf as esp import lvgl as lv # TODO: Viper/native emmitters don't behave well when module is frozen. class xpt2046: # Command is 8 bit, but we add another bit as a space before xpt2046 stats sending the response, See Figure 12 on the datasheet CMD_X_READ = const(0b1001...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/esp32/xpt2046.py
Python
apache-2.0
7,542
# Python driver for the AXP192 Power Management IC. # # https://gist.github.com/ropg/7216ba90a9d7697114d4ba8aea7bee3c # # Written in 2021 by Rop Gonggrijp. # # Some functionality inspired by C driver written by Mika Tuupola # (https://github.com/tuupola/axp192) and a fork of that maintained by # Brian Starkey (https:/...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/generic/axp192.py
Python
apache-2.0
10,553
# Pure Python LVGL indev driver for the FocalTech FT6X36 capacitive touch IC # # from ft6x36 import ft6x36 # # touch = ft6x36(sda=<pin>, scl=<pin>) # # If you set the size of the touchpad, you have the option to invert each # axis, and you'll get some extra robustness against occasional read errors # as ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/generic/ft6x36.py
Python
apache-2.0
3,453
# This is the minimal pure-python lvgl pointer-type driver. It does not read # any hardware and instead just presses at location (50,100) # # In a real driver, always return the last position in data.point, even if # the data.state goes to 'released' (lv.INDEV_STATE.RELEASED), so maybe keep # that in self.point. # # Th...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/generic/indev_example.py
Python
apache-2.0
1,133
#ifndef __LVMP_DRV_COMMON_H #define __LVMP_DRV_COMMON_H #include "py/obj.h" #include "py/runtime.h" #include "py/binary.h" ////////////////////////////////////////////////////////////////////////////// // A read-only buffer that contains a C pointer // Used to communicate function pointers to lvgl Micropython binding...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/include/common.h
C
apache-2.0
1,486
# # Important: # This is a JS specific version of imagetools.py # without native emitter since JS port doesnt support # "native" and "viper" decorators. # Other ports should use the imagetools.py from /lib # # # Library of functions for image manipulation. # Can be used with lodepng to decode PNG images: # # from i...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/js/imagetools.py
Python
apache-2.0
2,721
# Stub Timer implementation for the JS port. # # This does absolutely nothing beyond provide a class, so it will # not be suitable for any application which needs a timer. # # MIT license; Copyright (c) 2021 embeddedt class Timer: PERIODIC = 0 ONE_SHOT = 1 def __init__(self, id): pass def i...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/js/lv_timer.py
Python
apache-2.0
421
# LVGL indev driver for evdev mouse device # (for the unix micropython port) import ustruct import select import lvgl as lv # Default crosshair cursor class crosshair_cursor: def __init__(self, scr=None): self.scr = scr if scr else lv.scr_act() self.hor_res = self.scr.get_width() self.ver_...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/linux/evdev.py
Python
apache-2.0
2,974
# Timer that matches machine.Timer (https://docs.micropython.org/en/latest/library/machine.Timer.html) # for the unix port. # # MIT license; Copyright (c) 2021 Amir Gonnen # # Based on timer.py from micropython-lib (https://github.com/micropython/micropython-lib/blob/master/unix-ffi/machine/machine/timer.py) import...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/linux/lv_timer.py
Python
apache-2.0
4,296
/********************* * INCLUDES *********************/ #include "../../lib/lv_bindings/lvgl/lvgl.h" #include "../include/common.h" #include <stdlib.h> #include <unistd.h> #include <stddef.h> #include <stdio.h> #include <fcntl.h> #include <linux/fb.h> #include <sys/mman.h> #include <sys/ioctl.h> #include <pth...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/linux/modfb.c
C
apache-2.0
8,654
# This makefile only makes the unit test, benchmark and pngdetail and showpng # utilities. It does not make the PNG codec itself as shared or static library. # That is because: # LodePNG itself has only 1 source file (lodepng.cpp, can be renamed to # lodepng.c) and is intended to be included as source file in other pro...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/png/lodepng/Makefile
Makefile
apache-2.0
1,133
/* LodePNG Examples Copyright (c) 2005-2012 Lode Vandevenne This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including co...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/png/lodepng/examples/example_4bit_palette.cpp
C++
apache-2.0
3,796
/* LodePNG Examples Copyright (c) 2005-2010 Lode Vandevenne This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including co...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/png/lodepng/examples/example_bmp2png.cpp
C++
apache-2.0
4,514
/* LodePNG Examples Copyright (c) 2005-2012 Lode Vandevenne This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including co...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/png/lodepng/examples/example_decode.c
C
apache-2.0
2,802
/* LodePNG Examples Copyright (c) 2005-2012 Lode Vandevenne This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including co...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/png/lodepng/examples/example_decode.cpp
C++
apache-2.0
3,235
/* LodePNG Examples Copyright (c) 2005-2012 Lode Vandevenne This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including co...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/png/lodepng/examples/example_encode.c
C
apache-2.0
3,467
/* LodePNG Examples Copyright (c) 2005-2012 Lode Vandevenne This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including co...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/png/lodepng/examples/example_encode.cpp
C++
apache-2.0
3,612
/* LodePNG Examples Copyright (c) 2005-2015 Lode Vandevenne This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including co...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/driver/png/lodepng/examples/example_encode_type.cpp
C++
apache-2.0
2,557