Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmake/sysdep.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
# if defined(_WIN64)
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
# else
typedef signed __int32 intptr_t;
typedef unsigned __int32 uintptr_t;
# endif
#elif defined(_MSC_VER) // && _MSC_VER >= 1600
# include <stdint.h>
#else
Expand Down
6 changes: 3 additions & 3 deletions include/msgpack/zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ static inline void* msgpack_zone_malloc(msgpack_zone* zone, size_t size)
{
char* aligned =
(char*)(
(size_t)(
(uintptr_t)(
zone->chunk_list.ptr + (MSGPACK_ZONE_ALIGN - 1)
) / MSGPACK_ZONE_ALIGN * MSGPACK_ZONE_ALIGN
) & ~(uintptr_t)(MSGPACK_ZONE_ALIGN - 1)
);
size_t adjusted_size = size + (size_t)(aligned - zone->chunk_list.ptr);
if(zone->chunk_list.free >= adjusted_size) {
Expand All @@ -120,7 +120,7 @@ static inline void* msgpack_zone_malloc(msgpack_zone* zone, size_t size)
{
void* ptr = msgpack_zone_malloc_expand(zone, size + (MSGPACK_ZONE_ALIGN - 1));
if (ptr) {
return (char*)((size_t)(ptr) / MSGPACK_ZONE_ALIGN * MSGPACK_ZONE_ALIGN);
return (char*)((uintptr_t)(ptr) & ~(uintptr_t)(MSGPACK_ZONE_ALIGN - 1));
}
}
return NULL;
Expand Down