URL
https://opencores.org/ocsvn/dblclockfft/dblclockfft/trunk
Subversion Repositories dblclockfft
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 30 to Rev 31
- ↔ Reverse comparison
Rev 30 → Rev 31
/dblclockfft/trunk/sw/fftgen.cpp
20,6 → 20,9
// specifically in the spec.pdf file. If it's not there, type |
// make in the documents directory to build it. |
// |
// 20160123 - Thanks to Lesha Birukov, adjusted for MS Visual Studio 2012. |
// (Adjustments are at the top of the file ...) |
// |
// Creator: Dan Gisselquist, Ph.D. |
// Gisselquist Technology, LLC |
// |
49,10 → 52,46
//////////////////////////////////////////////////////////////////////////////// |
// |
// |
#define _CRT_SECURE_NO_WARNINGS // ms vs 2012 doesn't like fopen |
#include <stdio.h> |
#include <stdlib.h> |
#include <unistd.h> |
|
#ifdef _MSC_VER // added for ms vs compatibility |
|
#include <io.h> |
#include <direct.h> |
#define _USE_MATH_DEFINES |
#define R_OK 4 /* Test for read permission. */ |
#define W_OK 2 /* Test for write permission. */ |
#define X_OK 0 /* !!!!!! execute permission - unsupported in windows*/ |
#define F_OK 0 /* Test for existence. */ |
|
#if _MSC_VER <= 1700 |
|
long long llround(double d) { |
if (d<0) return -(long long)(-d+0.5); |
else return (long long)(d+0.5); } |
int lstat(const char *filename, struct stat *buf) { return 1; }; |
#define S_ISDIR(A) 0 |
|
#else |
|
#define lstat _stat |
#define S_ISDIR _S_IFDIR |
|
#endif |
|
#define mkdir(A,B) _mkdir(A) |
|
#define access _access |
|
#else |
// And for G++/Linux environment |
|
#include <unistd.h> // Defines the R_OK/W_OK/etc. macros |
#include <sys/stat.h> |
#endif |
|
#include <string.h> |
#include <string> |
#include <math.h> |
2067,8 → 2106,8
long long ic, is, vl; |
|
c = cos(W); s = sin(W); |
ic = (long long)round((1ll<<(cbits-2)) * c); |
is = (long long)round((1ll<<(cbits-2)) * s); |
ic = (long long)llround((1ll<<(cbits-2)) * c); |
is = (long long)llround((1ll<<(cbits-2)) * s); |
vl = (ic & (~(-1ll << (cbits)))); |
vl <<= (cbits); |
vl |= (is & (~(-1ll << (cbits)))); |
2976,5 → 3015,3
|
} |
} |
|
|