Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
Martin Reinecke
pypocketfft
Commits
36ccf05a
Commit
36ccf05a
authored
May 18, 2019
by
Martin Reinecke
Browse files
sync with pocketfft sources
parent
7eb4e922
Changes
1
Hide whitespace changes
Inline
Side-by-side
pocketfft_hdronly.h
View file @
36ccf05a
...
...
@@ -56,9 +56,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#ifdef
__GNUC__
#if
def
ined(
__GNUC__
)
#define NOINLINE __attribute__((noinline))
#define restrict __restrict__
#elif defined(_MSC_VER)
#define NOINLINE __declspec(noinline)
#define restrict __restrict
#else
#define NOINLINE
#define restrict
...
...
@@ -97,29 +100,48 @@ template<typename T> class arr
T
*
p
;
size_t
sz
;
#if defined(POCKETFFT_NO_VECTORS)
static
T
*
ralloc
(
size_t
num
)
{
if
(
num
==
0
)
return
nullptr
;
#ifdef POCKETFFT_NO_VECTORS
void
*
res
=
malloc
(
num
*
sizeof
(
T
));
if
(
!
res
)
throw
bad_alloc
();
#else
#if __cplusplus >= 201703L
return
reinterpret_cast
<
T
*>
(
res
);
}
static
void
dealloc
(
T
*
ptr
)
{
free
(
ptr
);
}
#elif __cplusplus >= 201703L
static
T
*
ralloc
(
size_t
num
)
{
if
(
num
==
0
)
return
nullptr
;
void
*
res
=
aligned_alloc
(
64
,
num
*
sizeof
(
T
));
if
(
!
res
)
throw
bad_alloc
();
return
reinterpret_cast
<
T
*>
(
res
);
}
static
void
dealloc
(
T
*
ptr
)
{
free
(
ptr
);
}
#elif defined(_WIN32)
static
T
*
ralloc
(
size_t
num
)
{
if
(
num
==
0
)
return
nullptr
;
void
*
res
=
_aligned_malloc
(
num
*
sizeof
(
T
),
64
);
if
(
!
res
)
throw
bad_alloc
();
return
reinterpret_cast
<
T
*>
(
res
);
}
static
void
dealloc
(
T
*
ptr
)
{
_aligned_free
(
ptr
);
}
#else
static
T
*
ralloc
(
size_t
num
)
{
if
(
num
==
0
)
return
nullptr
;
void
*
res
(
nullptr
);
if
(
posix_memalign
(
&
res
,
64
,
num
*
sizeof
(
T
))
!=
0
)
throw
bad_alloc
();
#endif
#endif
return
reinterpret_cast
<
T
*>
(
res
);
}
static
void
dealloc
(
T
*
ptr
)
{
free
(
ptr
);
}
#endif
public:
arr
()
:
p
(
0
),
sz
(
0
)
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment