aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/win32/sys.c
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-09-30 17:03:15 +0200
committerFredrik Gustafsson <[email protected]>2013-09-30 17:03:15 +0200
commit036727ce61cfbd51ece3d20a07d33c10c035ecec (patch)
tree783765a9157270e59469e33755f0c31564c52f90 /erts/emulator/sys/win32/sys.c
parent157c52840b3a83da5f753d932acae3480bf4bfd2 (diff)
parente0ecc86e35475b434efa6cccba44074ca1040b7a (diff)
downloadotp-036727ce61cfbd51ece3d20a07d33c10c035ecec.tar.gz
otp-036727ce61cfbd51ece3d20a07d33c10c035ecec.tar.bz2
otp-036727ce61cfbd51ece3d20a07d33c10c035ecec.zip
Merge branch 'maint'
Diffstat (limited to 'erts/emulator/sys/win32/sys.c')
-rwxr-xr-xerts/emulator/sys/win32/sys.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/erts/emulator/sys/win32/sys.c b/erts/emulator/sys/win32/sys.c
index 93bbae7dee..f6bd2b1b0f 100755
--- a/erts/emulator/sys/win32/sys.c
+++ b/erts/emulator/sys/win32/sys.c
@@ -32,7 +32,7 @@
#include "erl_threads.h"
#include "../../drivers/win32/win_con.h"
#include "erl_cpu_topology.h"
-
+#include <malloc.h>
void erts_sys_init_float(void);
@@ -2754,6 +2754,30 @@ void erts_sys_free(ErtsAlcType_t t, void *x, void *p)
free(p);
}
+void *erts_sys_aligned_alloc(UWord alignment, UWord size)
+{
+ void *ptr;
+ ASSERT(alignment && (alignment & ~alignment) == 0); /* power of 2 */
+ ptr = _aligned_malloc((size_t) size, (size_t) alignment);
+ ASSERT(!ptr || (((UWord) ptr) & (alignment - 1)) == 0);
+ return ptr;
+}
+
+void erts_sys_aligned_free(UWord alignment, void *ptr)
+{
+ ASSERT(alignment && (alignment & ~alignment) == 0); /* power of 2 */
+ _aligned_free(ptr);
+}
+
+void *erts_sys_aligned_realloc(UWord alignment, void *ptr, UWord size, UWord old_size)
+{
+ void *new_ptr;
+ ASSERT(alignment && (alignment & ~alignment) == 0); /* power of 2 */
+ new_ptr = _aligned_realloc(ptr, (size_t) size, (size_t) alignment);
+ ASSERT(!new_ptr || (((UWord) new_ptr) & (alignment - 1)) == 0);
+ return new_ptr;
+}
+
static Preload* preloaded = NULL;
static unsigned* res_name = NULL;
static int num_preloaded = 0;