commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 01/01: volk: adds a volk_malloc/free case f


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/01: volk: adds a volk_malloc/free case for Windows to use its _aligned_malloc.
Date: Fri, 15 Aug 2014 15:36:43 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch master
in repository gnuradio.

commit d93d30fd4c1e4b0ca247ce06598878b1af669620
Author: Stefan Oltmanns <address@hidden>
Date:   Fri Aug 15 11:35:52 2014 -0400

    volk: adds a volk_malloc/free case for Windows to use its _aligned_malloc.
---
 volk/lib/volk_malloc.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/volk/lib/volk_malloc.c b/volk/lib/volk_malloc.c
index b0ffcb5..d5e1709 100644
--- a/volk/lib/volk_malloc.c
+++ b/volk/lib/volk_malloc.c
@@ -75,6 +75,24 @@ void volk_free(void *ptr)
   free(ptr);
 }
 
+// _aligned_malloc has no restriction on size,
+// available on Windows since Visual C++ 2005
+#elif _MSC_VER >= 1400
+
+void *volk_malloc(size_t size, size_t alignment)
+{
+  void *ptr = _aligned_malloc(size, alignment);
+  if(ptr == NULL) {
+    fprintf(stderr, "VOLK: Error allocating memory (_aligned_malloc)\n");
+  }
+  return ptr;
+}
+
+void volk_free(void *ptr)
+{
+  _aligned_free(ptr);
+}
+
 // No standard handlers; we'll do it ourselves.
 #else // _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || 
HAVE_POSIX_MEMALIGN
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]