Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/include/sffe_cmplx_asm.h
blob: f14aae83d9881bf8cd9dac699f9b65f3988043a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*/////////////////////////////////////////////////////////////////////////////////////
// project : sFFe ( SegFault (or Segmentation Fault :) ) formula evalutaor )
// author  : Mateusz Malczak ( mateusz@malczak.info )
// wpage   : www.segfaultlabs.com/projects/sffe
///////////////////////////////////////////////////////////////////////////////////////
// special build for XaoS, for more info visit
// http://www.segfaultlabs.com/projects/sfXaos
/////////////////////////////////////////////////////////////////////////////////////*/
#ifndef SFFE_CMPLX_ASM_H
#define SFFE_CMPLX_ASM_H

#include <config.h>
#ifdef SFFE_CMPLX_ASM

#include "sffe.h"

#define sffnctscount 43
#define sfvarscount 6
#define cmplxset(c,r,i) ( c = cset(r,i) )
#define real(c) (c).r
#define imag(c) (c).i

#ifdef __ELF__
#define sffecabs   _sffecabs
#define sffecarg   _sffecarg
#define sffecargs  _sffecargs
#define sffecargc  _sffecargc
#define sffecinv   _sffecinv
#define sffecexp   _sffecexp
#define sffecln    _sffecln
#define sffeclog2  _sffeclog2
#define sffeclog   _sffeclog
#define sffecsin   _sffecsin
#define sffeccos   _sffeccos
#define sffectan   _sffectan
#define sffeccot   _sffeccot
#define sffecsinh  _sffecsinh
#define sffeccosh  _sffeccosh
#define sffectanh  _sffectanh
#define sffeccoth  _sffeccoth
#define sffeccpow  _sffeccpow
#define sffecpowd  _sffecpowd
#define sffecpowi  _sffecpowi
#define sffecpowc  _sffecpowc
#define sffecsqrt  _sffecsqrt
#define sffecrtni  _sffecrtni
#endif

#ifdef __cplusplus
extern "C" {
#endif

    /* written with asm in file cmplx.asm, compile with NASM */
    extern double sffecabs(const cmplx c);
    extern double sffecarg(const cmplx c);
    extern double sffecargs(const cmplx c);
    extern double sffecargc(const cmplx c);
    extern cmplx sffecinv(const cmplx c);
    extern cmplx sffecexp(const cmplx c);
    extern cmplx sffecln(const cmplx c);
    extern cmplx sffeclog2(const cmplx c);
    extern cmplx sffeclog(const cmplx c, unsigned int base);
    extern cmplx sffecsin(const cmplx c);
    extern cmplx sffeccos(const cmplx c);
    extern cmplx sffectan(const cmplx c);
    extern cmplx sffeccot(const cmplx c);
    extern cmplx sffecsinh(const cmplx c);
    extern cmplx sffeccosh(const cmplx c);
    extern cmplx sffectanh(const cmplx c);
    extern cmplx sffeccoth(const cmplx c);
    /* power functions */
    extern cmplx sffeccpow(const cmplx b, const cmplx exp);
    extern cmplx sffecpowd(const cmplx b, double exp);
    extern cmplx sffecpowi(const cmplx b, int exp);
    extern cmplx sffecpowc(double b, const cmplx exp);
    extern cmplx sffecsqrt(const cmplx b);	/* square root */
    extern cmplx sffecrtni(const cmplx b, int n, int i);	/* i-th solution of N-th order root of a CN */
/*complex numbers for mparser*/
    cmplx cset(double r, double i);
    cmplx cadd(const cmplx c1, const cmplx c2);
    cmplx csub(const cmplx c1, const cmplx c2);
    cmplx cmul(const cmplx c1, const cmplx c2);
    cmplx cdiv(const cmplx c1, const cmplx c2);
    sfarg *sfadd(sfarg * const p);	/*  +  */
    sfarg *sfsub(sfarg * const p);	/*  -  */
    sfarg *sfmul(sfarg * const p);	/*  *  */
    sfarg *sfdiv(sfarg * const p);	/*  /  */
    sfarg *sfsin(sfarg * const p);	/* sin */
    sfarg *sfcos(sfarg * const p);	/* cos */
    sfarg *sftan(sfarg * const p);	/* tan */
    sfarg *sfcot(sfarg * const p);	/* ctan */
    sfarg *sfasin(sfarg * const p);	/* asin */
    sfarg *sfacos(sfarg * const p);	/* acos */
    sfarg *sfatan(sfarg * const p);	/* atan */
    sfarg *sfacot(sfarg * const p);	/* actan */
    sfarg *sfatan2(sfarg * const p);	/* atan2 */
    sfarg *sfsinh(sfarg * const p);	/* sinh */
    sfarg *sfcosh(sfarg * const p);	/* cosh */
    sfarg *sftanh(sfarg * const p);	/* tanh */
    sfarg *sfcoth(sfarg * const p);	/* ctanh */
    sfarg *sfexp(sfarg * const p);	/* exp */
    sfarg *sflog(sfarg * const p);	/* log */
    sfarg *sflog2(sfarg * const p);	/* log2 */
    sfarg *sflog10(sfarg * const p);	/* log2 */
    sfarg *sflogN(sfarg * const p);	/* logN */
    sfarg *sflogCN(sfarg * const p);	/* logCN */
    sfarg *sfpow(sfarg * const p);	/* csflx pow */
    sfarg *sfpowi(sfarg * const p);	/* int pow */
    sfarg *sfpowd(sfarg * const p);	/* double pow */
    sfarg *sfpowdc(sfarg * const p);	/* double to csflx pow */
    sfarg *sfsqr(sfarg * const p);	/* sqr */
    sfarg *sfsqrt(sfarg * const p);	/* sqrt */
    sfarg *sfrtni(sfarg * const p);	/* rtni *//*cos tu nie tak jak powinno byc ;( */
    sfarg *sfinv(sfarg * const p);	/* cinv */
    sfarg *sfceil(sfarg * const p);	/* ceil */
    sfarg *sffloor(sfarg * const p);	/* floor */
    sfarg *sfabs(sfarg * const p);	/* abs - |z| */
    sfarg *sfre(sfarg * const p);	/* RE */
    sfarg *sfim(sfarg * const p);	/* IM */
    sfarg *sfrabs(sfarg * const p);	/* abs - real numbers */
    sfarg *sfrand(sfarg * const p);	/* rand */
/*const eval*/
    void sfcPI(sfNumber * cnst);
    void sfcPI2(sfNumber * cnst);
    void sfc2PI(sfNumber * cnst);
    void sfcE(sfNumber * cnst);
    void sfcI(sfNumber * cnst);
    void sfcRND(sfNumber * cnst);
#ifdef __cplusplus
}
#endif
/* all available function (function pointer, number of parameters, name )*/
    extern const sffunction sfcmplxfunc[sffnctscount];
/* all available buildin variables */
extern const char sfcnames[sfvarscount][5];
/* available variables function pointers */
extern const cfptr sfcvals[sfvarscount];

#endif
#endif