Changeset: 7249b011e34b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7249b011e34b
Modified Files:
        gdk/gdk_utils.mx
Branch: Apr2011
Log Message:

memory cap: calculate uint_max differently

As pointed out by Greg Burd, casting -1 to an unsigned type, may not be
reliable, across different compilers.


diffs (25 lines):

diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx
--- a/gdk/gdk_utils.mx
+++ b/gdk/gdk_utils.mx
@@ -515,8 +515,8 @@
 # ifdef SIZEOF_SIZE_T == SIZEOF_INT
                /* we can have more memory than a size_t can handle on a 32-bits
                 * platform, so trim it down, if that is the case */
-               if (size > (size_t)-1)
-                       size = (size_t)-1;
+               if (size > 0xffffffff)
+                       size = 0xffffffff;
 # endif
                _MT_npages = size / _MT_pagesize;
        }
@@ -535,8 +535,8 @@
 # ifdef SIZEOF_SIZE_T == SIZEOF_INT
                /* we can have more memory than a size_t can handle on a 32-bits
                 * platform, so trim it down, if that is the case */
-               if (size > (size_t)-1)
-                       size = (size_t)-1;
+               if (size > 0xffffffff)
+                       size = 0xffffffff;
 # endif
                _MT_npages = size / _MT_pagesize;
        }
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to