52 saved = *(
void **)((
DWORD_PTR)((
char *)
mem -
sizeof(
void *)) & ~(
sizeof(
void *) - 1));
82 saved = *(
void **)((
DWORD_PTR)((
char *)
mem -
sizeof(
void *)) & ~(
sizeof(
void *) - 1));
83 trace(
"_aligned_offset_malloc(%3d, %3d, %3d) returns %p, saved = %p\n",
94 void *
mem, *mem1, *mem2;
109 for (
i = 0;
i < size1;
i++)
110 ((
char *)
mem)[
i] =
i + 1;
115 "_aligned_malloc(%d, %d) not aligned: %p\n", size1,
alignment,
mem);
119 saved = *(
void **)((
DWORD_PTR)((
char *)
mem -
sizeof(
void *)) & ~(
sizeof(
void *) - 1));
120 trace(
"_aligned_malloc(%3d, %3d) returns %p, saved = %p\n", size1,
alignment,
mem, saved);
130 "_aligned_realloc(%p, %d, %d) not aligned: %p\n",
mem, size2,
alignment, mem2);
134 saved = *(
void **)((
DWORD_PTR)((
char *)mem2 -
sizeof(
void *)) & ~(
sizeof(
void *) - 1));
135 trace(
"_aligned_realloc(%p, %3d, %3d) returns %p, saved = %p\n",
140 ok(
memcmp(mem2, mem1,
min(size1, size2))==0,
"_aligned_realloc(%p, %d, %d) has different data\n",
mem, size2,
alignment);
144 for (
i = 0;
i <
min(size1, size2);
i++)
146 if (((
char *)mem2)[
i] != ((
char *)mem1)[
i])
147 trace(
"%d: %02x != %02x\n",
i, ((
char *)mem2)[
i] & 0xff, ((
char *)mem1)[
i] & 0xff);
151 p_aligned_free(mem2);
166 void *
mem, *mem1, *mem2;
181 for (
i = 0;
i < size1;
i++)
182 ((
char *)
mem)[
i] =
i + 1;
187 "_aligned_offset_malloc(%d, %d, %d) not aligned: %p\n", size1,
alignment,
offset,
mem);
191 saved = *(
void **)((
DWORD_PTR)((
char *)
mem -
sizeof(
void *)) & ~(
sizeof(
void *) - 1));
192 trace(
"_aligned_offset_malloc(%3d, %3d, %3d) returns %p, saved = %p\n",
203 "_aligned_offset_realloc(%p, %d, %d, %d) not aligned: %p\n",
mem, size2,
alignment,
offset, mem2);
207 saved = *(
void **)((
DWORD_PTR)((
char *)mem2 -
sizeof(
void *)) & ~(
sizeof(
void *) - 1));
208 trace(
"_aligned_offset_realloc(%p, %3d, %3d, %3d) returns %p, saved = %p\n",
213 ok(
memcmp(mem2, mem1,
min(size1, size2))==0,
"_aligned_offset_realloc(%p, %d, %d, %d) has different data\n",
mem, size2,
alignment,
offset);
217 for (
i = 0;
i <
min(size1, size2);
i++)
219 if (((
char *)mem2)[
i] != ((
char *)mem1)[
i])
220 trace(
"%d: %02x != %02x\n",
i, ((
char *)mem2)[
i] & 0xff, ((
char *)mem1)[
i] & 0xff);
224 p_aligned_free(mem2);
226 ok(
errno ==
EINVAL,
"_aligned_offset_realloc(%p, %d, %d, %d) errno: %d != %d\n",
mem, size2,
alignment,
offset,
errno,
EINVAL);
251 skip(
"aligned memory tests skipped\n");
424 p__set_sbh_threshold = (
void*)
GetProcAddress(msvcrt,
"_set_sbh_threshold");
425 p__get_sbh_threshold = (
void*)
GetProcAddress(msvcrt,
"_get_sbh_threshold");
426 if (!p__set_sbh_threshold || !p__get_sbh_threshold)
428 win_skip(
"_set_sbh_threshold not available\n");
432 if(
sizeof(
void*) == 8) {
433 ok(!p__set_sbh_threshold(0),
"_set_sbh_threshold succeeded\n");
434 ok(!p__set_sbh_threshold(1000),
"_set_sbh_threshold succeeded\n");
441 ok(p__set_sbh_threshold(1),
"_set_sbh_threshold failed\n");
442 threshold = p__get_sbh_threshold();
443 ok(threshold == 16,
"threshold = %d\n", threshold);
445 ok(p__set_sbh_threshold(8),
"_set_sbh_threshold failed\n");
446 threshold = p__get_sbh_threshold();
447 ok(threshold == 16,
"threshold = %d\n", threshold);
449 ok(p__set_sbh_threshold(1000),
"_set_sbh_threshold failed\n");
450 threshold = p__get_sbh_threshold();
451 ok(threshold == 1008,
"threshold = %d\n", threshold);
463 ok(p__set_sbh_threshold(0),
"_set_sbh_threshold failed\n");
464 threshold = p__get_sbh_threshold();
465 ok(threshold == 0,
"threshold = %d\n", threshold);
474 void *(
__cdecl *p_realloc)(
void *,
size_t);
481 ok(
mem !=
NULL,
"memory not allocated for size 0\n");
485 ok(
mem !=
NULL,
"memory not allocated\n");
488 ok(
mem !=
NULL,
"memory not reallocated\n");
494 ok(
mem !=
NULL,
"memory not (re)allocated for size 0\n");
502 void *(
__cdecl *p_calloc)(
size_t,
size_t);
507 ptr = p_calloc(1, 0);
511 ptr = p_calloc(0, 0);
515 ptr = p_calloc(0, 1);
520 ptr = p_calloc(~(
size_t)0 / 2, ~(
size_t)0 / 2);
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
_CRTIMP intptr_t __cdecl _get_heap_handle(void)
#define GetProcAddress(x, y)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memcpy(s1, s2, n)
static void test_aligned_malloc(unsigned int size, unsigned int alignment)
static void test_aligned_offset_realloc(unsigned int size1, unsigned int size2, unsigned int alignment, unsigned int offset)
static void *__cdecl * p_aligned_offset_realloc(void *, size_t, size_t, size_t)
static void test_calloc(void)
static void *__cdecl * p_aligned_offset_malloc(size_t, size_t, size_t)
static void *__cdecl * p_aligned_realloc(void *, size_t, size_t)
static void test_aligned_realloc(unsigned int size1, unsigned int size2, unsigned int alignment)
static void test_aligned(void)
static void *__cdecl * p_aligned_malloc(size_t, size_t)
static void test_sbheap(void)
static void test_malloc(void)
static void test__get_heap_handle(void)
static void test_aligned_offset_malloc(unsigned int size, unsigned int alignment, unsigned int offset)
static void *CDECL * p_malloc(size_t)
unsigned __int3264 UINT_PTR