This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct echo | |
{ | |
void operator()(const float* a, int size) | |
{ | |
for(int n = 0; n < size; ++n) | |
printf("%15d%15.5f\n", n, a[n]); | |
} | |
void operator()(const float* a, const float* b, int size) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline void rs32f_test(const char*, const char*, void*, node<message*>** errors) | |
{ | |
int status; | |
float data[] = {43.13, 42.66, 43.42, 44.57, 44.22, 44.18, 44.03, 45.35, 45.78, 46.45, 45.71, 46.25, | |
46.21, 45.64, 46.22, 46.41, 46.03, 46.00, 46.28, 46.28, 45.61, 46.03, 45.89, 46.08, | |
45.84, 45.42, 45.10, 44.83, 44.33, 43.61, 44.15, 44.09, 44.34 | |
}; | |
float rs [] = {0.60701822435637, 0.49431092655862, 0.594999156777, 0.8336246868167, | |
0.72025005002827, 0.70824775083558, 0.66638402420065, 1.01705518638599, 1.20787462282414, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline void ema32f_test(const char*, const char*, void*, node<message*>** errors) | |
{ | |
int status = ippStsNoErr; | |
float data[] = {22.17, 22.40, 23.10, 22.68, 23.33, 23.10, 23.19, 23.65, 23.87, 23.82, 23.63, | |
23.95, 23.83, 23.75, 24.05, 23.36, 22.61, 22.38, 22.39, 22.15, 22.29, 22.24, 22.43, 22.23, | |
22.13, 22.18, 22.17, 22.08, 22.19, 22.27 | |
}; | |
float expected [] = {22.9155602300309, 23.0806847255934, 23.2313924423919, 23.2611240962568, | |
23.3901516732027, 23.4044076005811, 23.4725870673769, 23.5360508601273, 23.5099066068223, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
DT_BLK This is a block device. | |
DT_CHR This is a character device. | |
DT_DIR This is a directory. | |
DT_FIFO This is a named pipe (FIFO). | |
DT_LNK This is a symbolic link. | |
DT_REG This is a regular file. | |
DT_SOCK This is a UNIX domain socket. | |
DT_UNKNOWN The file type is unknown. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline char* ltrim(char* const s) | |
{ | |
int len; | |
char* cur; | |
if(s && *s) | |
{ | |
len = strlen(s); | |
cur = s; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline bool is_negative(float x) | |
{ | |
unsigned int* ui = (unsigned int*)&x; | |
return (*ui & 0x80000000) != 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline bool ispowerof2(int i) | |
{ | |
return i > 0 && (i & (i - 1)) == 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<unsigned char b> | |
struct ByteBits | |
{ | |
enum | |
{ | |
COUNT = ((b >> 0) & 1) + | |
((b >> 1) & 1) + | |
((b >> 2) & 1) + | |
((b >> 3) & 1) + | |
((b >> 4) & 1) + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline void shuffle(int* card, int cardsn) | |
{ | |
for(int n = 0; n < cardsn; n++) | |
{ | |
int adj = cardsn - n; | |
int m = (rand() % adj) + n; | |
int tmp = card[n]; | |
card[n] = card[m]; | |
card[m] = tmp; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline void reverse_string(char* A) | |
{ | |
#define SWAPVAR(A,B) (A^=B, B^=A, A^=B) | |
char* B = A; | |
while(B && *B) ++B; | |
for(--B; A < B; ++A, --B) SWAPVAR(*A, *B); | |
} |