From fd0072e77cd28d52e00ea77542ba6d11018889b5 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Sun, 17 Aug 2008 17:08:00 +0000 Subject: Win64: please check my changes if you ran across them ;) But should be fine since no additional crashes were reported! --- intern/opennl/superlu/BLO_sys_types.h | 112 ++++++++++++++++++++++++++++++++++ intern/opennl/superlu/smemory.c | 10 +-- 2 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 intern/opennl/superlu/BLO_sys_types.h (limited to 'intern/opennl/superlu') diff --git a/intern/opennl/superlu/BLO_sys_types.h b/intern/opennl/superlu/BLO_sys_types.h new file mode 100644 index 00000000000..17fa99308e0 --- /dev/null +++ b/intern/opennl/superlu/BLO_sys_types.h @@ -0,0 +1,112 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + * A platform-independent definition of [u]intXX_t + * Plus the accompanying header include for htonl/ntohl + * + * This file includes to define [u]intXX_t types, where + * XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this + * file. + * - Windows uses __intXX compiler-builtin types. These are signed, + * so we have to flip the signs. + * For these rogue platforms, we make the typedefs ourselves. + * + */ + +/* +// DG: original BLO_sys_types.h is in source/blender/blenkernel +// but is not allowed be accessed here because of bad-level-call +*/ + +#ifndef BLO_SYS_TYPES_H +#define BLO_SYS_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef FREE_WINDOWS +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +#endif + +#if defined(_WIN32) && !defined(FREE_WINDOWS) + +/* The __intXX are built-in types of the visual complier! So we don't + * need to include anything else here. */ + +typedef signed __int8 int8_t; +typedef signed __int16 int16_t; +typedef signed __int32 int32_t; +typedef signed __int64 int64_t; + +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; + +#ifdef _WIN64 +typedef __int64 intptr_t; +typedef unsigned __int64 uintptr_t; +#else +typedef long intptr_t; +typedef unsigned long uintptr_t; +#endif + +#elif defined(__linux__) + + /* Linux-i386, Linux-Alpha, Linux-ppc */ +#include + +#elif defined (__APPLE__) + +#include + +#else + + /* FreeBSD, Irix, Solaris */ +#include + +#endif /* ifdef platform for types */ + +#ifdef _WIN32 +#define htonl(x) correctByteOrder(x) +#define ntohl(x) correctByteOrder(x) +#elif defined (__FreeBSD__) || defined (__OpenBSD__) +#include +#elif defined (__APPLE__) +#include +#else /* irix sun linux */ +#include +#endif /* ifdef platform for htonl/ntohl */ + +#ifdef __cplusplus +} +#endif + +#endif /* eof */ + diff --git a/intern/opennl/superlu/smemory.c b/intern/opennl/superlu/smemory.c index 79da748671a..7eefb900673 100644 --- a/intern/opennl/superlu/smemory.c +++ b/intern/opennl/superlu/smemory.c @@ -8,6 +8,8 @@ */ #include "ssp_defs.h" +#include "BLO_sys_types.h" // needed for intptr_t + /* Constants */ #define NO_MEMTYPE 4 /* 0: lusup; 1: ucol; @@ -49,8 +51,8 @@ static int no_expand; /* Macros to manipulate stack */ #define StackFull(x) ( x + stack.used >= stack.size ) -#define NotDoubleAlign(addr) ( (long int)addr & 7 ) -#define DoubleAlign(addr) ( ((long int)addr + 7) & ~7L ) +#define NotDoubleAlign(addr) ( (intptr_t)addr & 7 ) +#define DoubleAlign(addr) ( ((intptr_t)addr + 7) & ~7L ) #define TempSpace(m, w) ( (2*w + 4 + NO_MARKER) * m * sizeof(int) + \ (w + 1) * m * sizeof(float) ) #define Reduce(alpha) ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */ @@ -611,8 +613,8 @@ sStackCompress(GlobalLU_t *Glu) last = (char*)usub + xusub[ndim] * iword; fragment = (char*) (((char*)stack.array + stack.top1) - last); - stack.used -= (long int) fragment; - stack.top1 -= (long int) fragment; + stack.used -= (intptr_t) fragment; + stack.top1 -= (intptr_t) fragment; Glu->ucol = ucol; Glu->lsub = lsub; -- cgit v1.2.3