diff options
author | Erik Reckase <e.reckase@gmail.com> | 2010-11-21 18:37:22 +0000 |
---|---|---|
committer | Scott Draves <spot@draves.org> | 2015-02-15 12:20:14 -0500 |
commit | 83ecdc6104f930f3520f7a687ae21b305434599c (patch) | |
tree | 90944d1762cd02a912e2c3b7cd907d4e0f7b11e6 /src | |
parent | ba1a8451bf2054193a8215995e1edb1d4661e0e2 (diff) | |
download | pucket-83ecdc6104f930f3520f7a687ae21b305434599c.tar.gz pucket-83ecdc6104f930f3520f7a687ae21b305434599c.tar.bz2 pucket-83ecdc6104f930f3520f7a687ae21b305434599c.zip |
support for 64-bit Apple OS in memory check
git-svn-id: https://flam3.googlecode.com/svn/trunk@91 77852712-ef1d-11de-8684-7d64432d61a3
Diffstat (limited to 'src')
-rw-r--r-- | src/flam3-render.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/flam3-render.c b/src/flam3-render.c index 7273fdb..ddab377 100644 --- a/src/flam3-render.c +++ b/src/flam3-render.c @@ -49,15 +49,21 @@ int calc_nstrips(flam3_frame *spec) { mem_available = (double)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE); #elif defined __APPLE__ - unsigned int physmem; - size_t len = sizeof(physmem); - static int mib[2] = { CTL_HW, HW_PHYSMEM }; - if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0 && len == sizeof(physmem)) { - mem_available = (double )physmem; - } else { - fprintf(stderr, "warning: unable to determine physical memory.\n"); - mem_available = 2e9; - } +#ifdef __LP64__ +long physmem; +size_t len = sizeof(physmem); +static int mib[2] = { CTL_HW, HW_MEMSIZE }; +#else +unsigned int physmem; +size_t len = sizeof(physmem); +static int mib[2] = { CTL_HW, HW_PHYSMEM }; +#endif +if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0 && len == sizeof(physmem)) { + mem_available = (double )physmem; +} else { + fprintf(stderr, "warning: unable to determine physical memory.n"); + mem_available = 2e9; +} #else fprintf(stderr, "warning: unable to determine physical memory.\n"); mem_available = 2e9; |