Browse code

engine bb#8640 - fixed mempool issue with 64-bit pointers in Windows

Kevin Lin authored on 2014/11/19 07:15:45
Showing 1 changed files
... ...
@@ -623,7 +623,11 @@ void *mpool_malloc(struct MP *mp, size_t size) {
623 623
     struct FRAG *fold = f;
624 624
     mp->avail[sbits] = f->u.next.ptr;
625 625
     /* we always have enough space for this, align_increase ensured that */
626
-    f = (struct FRAG*)(alignto((unsigned long)f + FRAG_OVERHEAD, align)-FRAG_OVERHEAD);
626
+#ifdef _WIN64
627
+	f = (struct FRAG*)(alignto((unsigned long long)f + FRAG_OVERHEAD, align)-FRAG_OVERHEAD);
628
+#else
629
+	f = (struct FRAG*)(alignto((unsigned long)f + FRAG_OVERHEAD, align)-FRAG_OVERHEAD);
630
+#endif
627 631
     f->u.a.sbits = sbits;
628 632
     f->u.a.padding = (char*)f - (char*)fold;
629 633
 #ifdef CL_DEBUG