diff options
Diffstat (limited to 'src/c')
43 files changed, 920 insertions, 0 deletions
diff --git a/src/c/auxiliaryFunctions/includes/rand.h b/src/c/auxiliaryFunctions/includes/rand.h index 4716cbb..d032a12 100644 --- a/src/c/auxiliaryFunctions/includes/rand.h +++ b/src/c/auxiliaryFunctions/includes/rand.h @@ -17,6 +17,7 @@ #include "dynlib_auxiliaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -46,6 +47,35 @@ EXTERN_AUXFUNCT floatComplex crands(void); **/ EXTERN_AUXFUNCT doubleComplex zrands(void); + +/** + ** \brief uint8 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double u8rands(void); + + +/** + ** \brief uint16 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double u16rands(void); + + +/** + ** \brief int8 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double i8rands(void); + + +/** + ** \brief int16 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double i16rands(void); + + /** ** \brief Float Array Rand function ** \return A random float array. @@ -70,6 +100,32 @@ EXTERN_AUXFUNCT void cranda(floatComplex *out, int size); **/ EXTERN_AUXFUNCT void zranda(doubleComplex *out, int size); +/** + ** \brief uint8 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void u8randa(double *out, int size); + +/** + ** \brief uint16 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void u16randa(double *out, int size); + + +/** + ** \brief int8 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void i8randa(double *out, int size); + +/** + ** \brief int16 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void i16randa(double *out, int size); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/auxiliaryFunctions/interfaces/int_rand.h b/src/c/auxiliaryFunctions/interfaces/int_rand.h index 597309a..85d08ea 100644 --- a/src/c/auxiliaryFunctions/interfaces/int_rand.h +++ b/src/c/auxiliaryFunctions/interfaces/int_rand.h @@ -20,6 +20,14 @@ #define randd0() drands() +#define randu80() u8rands() + +#define randu160() u16rands() + +#define randi80() i8rands() + +#define randi160() i16rands() + #define s0rands0(in) srands() @@ -30,16 +38,39 @@ #define z0randz0(in) zrands() +#define u80randd0(in) u8rands() + +#define u160randd0(in) u16rands() + +#define i80randd0(in) i8rands() + +#define i160randd0(in) i16rands() + #define s0s0rands0(in1,in2) srands() #define d0d0randd0(in,in2) drands() +#define u80u80randd0(in1,in2) u8rands() + +#define u160u160randd0(in1,in2) u16rands() + +#define i80i80randd0(in1,in2) i8rands() + +#define i160i160randd0(in1,in2) i16rands() + #define s0s0rands2(in1,in2,out) sranda(out,(int)in1*(int)in2) #define d0d0randd2(in1,in2,out) dranda(out,(int)in1*(int)in2) +#define u80u80randd2(in1,in2,out) u8randa(out,(int)in1*(int)in2) + +#define u160u160randd2(in1,in2,out) u16randa(out,(int)in1*(int)in2) + +#define i80i80randd2(in1,in2,out) i8randa(out,(int)in1*(int)in2) + +#define i160i160randd2(in1,in2,out) i16randa(out,(int)in1*(int)in2) #define s2rands2(in,size,out) sranda(out, size[0]*size[1]) @@ -49,5 +80,15 @@ #define z2randz2(in,size,out) zranda(out, size[0]*size[1]) +#define u82randd2(in,size,out) u8randa(out, size[0]*size[1]) + +#define u162randd2(in,size,out) u16randa(out, size[0]*size[1]) + +#define i82randd2(in,size,out) i8randa(out, size[0]*size[1]) + +#define i62randd2(in,size,out) i16randa(out, size[0]*size[1]) + + + #endif /* !__INT_RAND_H__ */ diff --git a/src/c/auxiliaryFunctions/rand/i16randa.c b/src/c/auxiliaryFunctions/rand/i16randa.c new file mode 100644 index 0000000..f3d8dd3 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i16randa.c @@ -0,0 +1,12 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" + +void i16randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = i16rands(); + } + +} diff --git a/src/c/auxiliaryFunctions/rand/i16rands.c b/src/c/auxiliaryFunctions/rand/i16rands.c new file mode 100644 index 0000000..ca2ed9c --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i16rands.c @@ -0,0 +1,46 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double i16rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + + + + + +} diff --git a/src/c/auxiliaryFunctions/rand/i8randa.c b/src/c/auxiliaryFunctions/rand/i8randa.c new file mode 100644 index 0000000..d679c65 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i8randa.c @@ -0,0 +1,12 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" + +void i8randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = i8rands(); + } + +} diff --git a/src/c/auxiliaryFunctions/rand/i8rands.c b/src/c/auxiliaryFunctions/rand/i8rands.c new file mode 100644 index 0000000..55df909 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i8rands.c @@ -0,0 +1,42 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double i8rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + +} diff --git a/src/c/auxiliaryFunctions/rand/u16randa.c b/src/c/auxiliaryFunctions/rand/u16randa.c new file mode 100644 index 0000000..f539336 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u16randa.c @@ -0,0 +1,12 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" + +void u16randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = u16rands(); + } + +} diff --git a/src/c/auxiliaryFunctions/rand/u16rands.c b/src/c/auxiliaryFunctions/rand/u16rands.c new file mode 100644 index 0000000..a08d6a8 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u16rands.c @@ -0,0 +1,46 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double u16rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + + + +} + + diff --git a/src/c/auxiliaryFunctions/rand/u8randa.c b/src/c/auxiliaryFunctions/rand/u8randa.c new file mode 100644 index 0000000..4d7d3f8 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u8randa.c @@ -0,0 +1,15 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" +#include<stdio.h> +void u8randa(double *out,int size) +{ + + int i = 0; + + for(i = 0 ; i < size ; ++i) + { + out[i] = u8rands(); + + } + +} diff --git a/src/c/auxiliaryFunctions/rand/u8rands.c b/src/c/auxiliaryFunctions/rand/u8rands.c new file mode 100644 index 0000000..bdf7f9a --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u8rands.c @@ -0,0 +1,68 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double u8rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + + while(m>m2) + { + + m2=m; + + m=itwo*m2; + + } + + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + + mic = (m2 - ic) + m2; + + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + + +} + +/* compute next random number */ + iy = iy*ia; + +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) +{ + iy = (iy - m2) - m2; + +} + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) +{ + iy = (iy - m2) - m2; + +} + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) + { + iy = (iy + m2) + m2; + + } + + return (double)iy*s; + + + + + +} diff --git a/src/c/elementaryFunctions/bitand/u16bitanda.c b/src/c/elementaryFunctions/bitand/u16bitanda.c new file mode 100644 index 0000000..743161e --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u16bitanda.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitand.h" + +void u16bitanda(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u16bitands(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitand/u16bitands.c b/src/c/elementaryFunctions/bitand/u16bitands.c new file mode 100644 index 0000000..7ba73c1 --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u16bitands.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitand.h" + +uint16 u16bitands(uint16 x,uint16 y) +{ + return (x & y); + +} diff --git a/src/c/elementaryFunctions/bitand/u8bitanda.c b/src/c/elementaryFunctions/bitand/u8bitanda.c new file mode 100644 index 0000000..e1260a7 --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u8bitanda.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitand.h" + +void u8bitanda(uint8* x,uint8* y,int size,uint8* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u8bitands(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitand/u8bitands.c b/src/c/elementaryFunctions/bitand/u8bitands.c new file mode 100644 index 0000000..eda3ccc --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u8bitands.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitand.h" + +uint8 u8bitands(uint8 x,uint8 y) +{ + return (x & y); + +} diff --git a/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c b/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c new file mode 100644 index 0000000..5581371 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitcmp.h" +void u16bitcmpa(uint16 *x,uint16 y,int size,uint16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i] = u16bitcmps(x[i],y); + + } + + +} + + diff --git a/src/c/elementaryFunctions/bitcmp/u16bitcmps.c b/src/c/elementaryFunctions/bitcmp/u16bitcmps.c new file mode 100644 index 0000000..fc43b37 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u16bitcmps.c @@ -0,0 +1,11 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitcmp.h" +uint16 u16bitcmps(uint16 x,uint16 y) +{ + + return (~x); + +} + + diff --git a/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c b/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c new file mode 100644 index 0000000..67bde28 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitcmp.h" +void u8bitcmpa(uint8 *x,uint8 y,int size,uint8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i] = u8bitcmps(x[i],y); + + } + + +} + + diff --git a/src/c/elementaryFunctions/bitcmp/u8bitcmps.c b/src/c/elementaryFunctions/bitcmp/u8bitcmps.c new file mode 100644 index 0000000..c3f18b1 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u8bitcmps.c @@ -0,0 +1,10 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitcmp.h" +uint8 u8bitcmps(uint8 x,uint8 y) +{ + return (~x); + +} + + diff --git a/src/c/elementaryFunctions/bitget/u16bitgets.c b/src/c/elementaryFunctions/bitget/u16bitgets.c new file mode 100644 index 0000000..20593bf --- /dev/null +++ b/src/c/elementaryFunctions/bitget/u16bitgets.c @@ -0,0 +1,24 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitget.h" +#include<stdio.h> + +uint16 u16bitgets(uint16 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint16 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/src/c/elementaryFunctions/bitget/u8bitgets.c b/src/c/elementaryFunctions/bitget/u8bitgets.c new file mode 100644 index 0000000..130bff8 --- /dev/null +++ b/src/c/elementaryFunctions/bitget/u8bitgets.c @@ -0,0 +1,24 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitget.h" +#include<stdio.h> + +uint8 u8bitgets(uint8 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint8 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/src/c/elementaryFunctions/bitor/u16bitora.c b/src/c/elementaryFunctions/bitor/u16bitora.c new file mode 100644 index 0000000..84722e1 --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u16bitora.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitor.h" + +void u16bitora(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u16bitors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitor/u16bitors.c b/src/c/elementaryFunctions/bitor/u16bitors.c new file mode 100644 index 0000000..e48e300 --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u16bitors.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitor.h" + +uint16 u16bitors(uint16 x,uint16 y) +{ + return (x | y); + +} diff --git a/src/c/elementaryFunctions/bitor/u8bitora.c b/src/c/elementaryFunctions/bitor/u8bitora.c new file mode 100644 index 0000000..edda9bb --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u8bitora.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitor.h" + +void u8bitora(uint8* x,uint8* y,int size,uint8* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u8bitors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitor/u8bitors.c b/src/c/elementaryFunctions/bitor/u8bitors.c new file mode 100644 index 0000000..56d3540 --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u8bitors.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitor.h" + +uint8 u8bitors(uint8 x,uint8 y) +{ + return (x | y); + +} diff --git a/src/c/elementaryFunctions/bitset/u16bitsets.c b/src/c/elementaryFunctions/bitset/u16bitsets.c new file mode 100644 index 0000000..953e46c --- /dev/null +++ b/src/c/elementaryFunctions/bitset/u16bitsets.c @@ -0,0 +1,20 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitset.h" +#include<stdio.h> + +uint16 u16bitsets(uint16 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + return (mask2 & value); + + } + +} diff --git a/src/c/elementaryFunctions/bitset/u8bitsets.c b/src/c/elementaryFunctions/bitset/u8bitsets.c new file mode 100644 index 0000000..5f44dcd --- /dev/null +++ b/src/c/elementaryFunctions/bitset/u8bitsets.c @@ -0,0 +1,20 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitset.h" +#include<stdio.h> + +uint8 u8bitsets(uint8 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + return (mask2 & value); + + } + +} diff --git a/src/c/elementaryFunctions/bitxor/u16bitxora.c b/src/c/elementaryFunctions/bitxor/u16bitxora.c new file mode 100644 index 0000000..6f50f06 --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u16bitxora.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitxor.h" + +void u16bitxora(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u16bitxors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitxor/u16bitxors.c b/src/c/elementaryFunctions/bitxor/u16bitxors.c new file mode 100644 index 0000000..03ca8f8 --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u16bitxors.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitxor.h" + +uint16 u16bitxors(uint16 x,uint16 y) +{ + return (x ^ y); + +} diff --git a/src/c/elementaryFunctions/bitxor/u8bitxora.c b/src/c/elementaryFunctions/bitxor/u8bitxora.c new file mode 100644 index 0000000..ad7cc24 --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u8bitxora.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitxor.h" + +void u8bitxora(uint8* x,uint8* y,int size,uint8* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u8bitxors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitxor/u8bitxors.c b/src/c/elementaryFunctions/bitxor/u8bitxors.c new file mode 100644 index 0000000..9a346ee --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u8bitxors.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitxor.h" + +uint8 u8bitxors(uint8 x,uint8 y) +{ + return (x ^ y); + +} diff --git a/src/c/elementaryFunctions/includes/bitand.h b/src/c/elementaryFunctions/includes/bitand.h new file mode 100644 index 0000000..8d98d9b --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitand.h @@ -0,0 +1,39 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITAND_H__ +#define __BITAND_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif +/* bitand returns the logical AND operation + 12 = 00001100 (In Binary) + 25 = 00011001 (In Binary) + +Bit Operation of 12 and 25 + 00001100 +& 00011001 + ________ + 00001000 = 8 (In decimal) +*/ + +EXTERN_ELEMFUNCT uint8 u8bitands(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitanda(uint8* in1,uint8* in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitands(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitanda(uint16* in1,uint16* in2,int size,uint16* out); + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITAND_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitcmp.h b/src/c/elementaryFunctions/includes/bitcmp.h new file mode 100644 index 0000000..8176681 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitcmp.h @@ -0,0 +1,38 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITCMP_H__ +#define __BITCMP_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif +/* bitcmp returns the complement +35=00100011 (In Binary) + +Bitwise complement Operation of 35 +~ 00100011 + ________ + 11011100 = 220 (In decimal) +*/ + +EXTERN_ELEMFUNCT uint8 u8bitcmps(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitcmpa(uint8* in1,uint8 in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitcmps(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitcmpa(uint16* in1,uint16 in2,int size,uint16* out); + + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITCMP_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitget.h b/src/c/elementaryFunctions/includes/bitget.h new file mode 100644 index 0000000..0eaf57e --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitget.h @@ -0,0 +1,25 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITGET_H__ +#define __BITGET_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif + + +EXTERN_ELEMFUNCT uint8 u8bitgets(uint8 value,int position); + +EXTERN_ELEMFUNCT uint16 u16bitgets(uint16 value,int position); + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITGET_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitor.h b/src/c/elementaryFunctions/includes/bitor.h new file mode 100644 index 0000000..16a6a3d --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitor.h @@ -0,0 +1,38 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITOR_H__ +#define __BITOR_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif +/* bitor returns the logical OR operation + 12 = 00001100 (In Binary) +25 = 00011001 (In Binary) + +Bitwise OR Operation of 12 and 25 + 00001100 +| 00011001 + ________ + 00011101 = 29 (In decimal) */ + +EXTERN_ELEMFUNCT uint8 u8bitors(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitora(uint8* in1,uint8* in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitors(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitora(uint16* in1,uint16* in2,int size,uint16* out); + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITOR_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitset.h b/src/c/elementaryFunctions/includes/bitset.h new file mode 100644 index 0000000..862a4c8 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitset.h @@ -0,0 +1,25 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITSET_H__ +#define __BITSET_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif + + +EXTERN_ELEMFUNCT uint8 u8bitsets(uint8 value,int position,int bit_value); + +EXTERN_ELEMFUNCT uint16 u16bitsets(uint16 value,int position,int bit_value); + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITSET_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitxor.h b/src/c/elementaryFunctions/includes/bitxor.h new file mode 100644 index 0000000..4e27635 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitxor.h @@ -0,0 +1,38 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITXOR_H__ +#define __BITXOR_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif +/* bitxor returns the logical OR operation + 12 = 00001100 (In Binary) +25 = 00011001 (In Binary) + +Bitwise XOR Operation of 12 and 25 + 00001100 +^ 00011001 + ________ + 00010101 = 21 (In decimal) */ + +EXTERN_ELEMFUNCT uint8 u8bitxors(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitxora(uint8* in1,uint8* in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitxors(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitxora(uint16* in1,uint16* in2,int size,uint16* out); + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITXOR_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_bitand.h b/src/c/elementaryFunctions/interfaces/int_bitand.h new file mode 100644 index 0000000..26031ad --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitand.h @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITAND_H__ +#define __INT_BITAND_H__ + + +#define u80u80bitandu80(in1,in2) u8bitands(in1,in2) + +#define u82u82bitandu82(in1,size1,in2,size2,out) u8bitanda(in1,in2,size1[0]*size1[1],out) + +#define u160u160bitandu160(in1,in2) u16bitands(in1,in2) + +#define u162u162bitandu162(in1,size1,in2,size2,out) u16bitanda(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitcmp.h b/src/c/elementaryFunctions/interfaces/int_bitcmp.h new file mode 100644 index 0000000..d72eb2e --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitcmp.h @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITCMP_H__ +#define __INT_BITCMP_H__ + + +#define u80d0bitcmpu80(in1,in2) u8bitcmps(in1,in2) + +#define u82d0bitcmpu82(in1,size1,in2,out) u8bitcmpa(in1,in2,size1[0]*size1[1],out) + +#define u160d0bitcmpu160(in1,in2) u16bitcmps(in1,in2) + +#define u162d0bitcmpu162(in1,size1,in2,out) u16bitcmpa(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitget.h b/src/c/elementaryFunctions/interfaces/int_bitget.h new file mode 100644 index 0000000..7b6b8e9 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitget.h @@ -0,0 +1,10 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITGET_H__ +#define __INT_BITGET_H__ + +#define u80d0bitgetu80(in1,in2) u8bitgets(in1,in2) + +#define u160d0bitgetu160(in1,in2) u16bitgets(in1,in2) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitor.h b/src/c/elementaryFunctions/interfaces/int_bitor.h new file mode 100644 index 0000000..6a65c9f --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitor.h @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITOR_H__ +#define __INT_BITOR_H__ + + +#define u80u80bitoru80(in1,in2) u8bitors(in1,in2) + +#define u82u82bitoru82(in1,size1,in2,size2,out) u8bitora(in1,in2,size1[0]*size1[1],out) + +#define u160u160bitoru160(in1,in2) u16bitors(in1,in2) + +#define u162u162bitoru162(in1,size1,in2,size2,out) u16bitora(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitset.h b/src/c/elementaryFunctions/interfaces/int_bitset.h new file mode 100644 index 0000000..e864325 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitset.h @@ -0,0 +1,13 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITSET_H__ +#define __INT_BITSET_H__ + +#define u80d0d0bitsetu80(in1,in2,in3) u8bitsets(in1,in2,in3) + +#define u160d0d0bitsetu160(in1,in2,in3) u16bitsets(in1,in2,in3) + + + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitxor.h b/src/c/elementaryFunctions/interfaces/int_bitxor.h new file mode 100644 index 0000000..30aea6c --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitxor.h @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITXOR_H__ +#define __INT_BITXOR_H__ + + +#define u80u80bitxoru80(in1,in2) u8bitxors(in1,in2) + +#define u82u82bitxoru82(in1,size1,in2,size2,out) u8bitxora(in1,in2,size1[0]*size1[1],out) + +#define u160u160bitxoru160(in1,in2) u16bitxors(in1,in2) + +#define u162u162bitxoru162(in1,size1,in2,size2,out) u16bitxora(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c index 621afc8..2e5c90d 100644 --- a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c +++ b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c @@ -11,6 +11,7 @@ */ #include "cmd_digital_out.h" +#include "Arduino.h" uint8 u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value) |