mirror of
https://github.com/ZDoom/zdbsp.git
synced 2024-11-10 06:31:35 +00:00
- Fix compilation of ZDBSP on Macs.
SVN r2521 (trunk)
This commit is contained in:
parent
8a58580de2
commit
c563e67a21
8 changed files with 54 additions and 7 deletions
|
@ -17,7 +17,6 @@
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
1
getopt.c
1
getopt.c
|
@ -43,6 +43,7 @@ USA. */
|
|||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
|
|
2
getopt.h
2
getopt.h
|
@ -99,6 +99,7 @@ struct option
|
|||
#define optional_argument 2
|
||||
|
||||
#if (defined (__STDC__) && __STDC__) || (defined (__cplusplus))
|
||||
#ifndef __APPLE__
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* Many other libraries have conflicting prototypes for getopt, with
|
||||
differences in the consts, in stdlib.h. To avoid compilation
|
||||
|
@ -107,6 +108,7 @@ extern int getopt (int argc, char *const *argv, const char *shortopts);
|
|||
#else /* not __GNU_LIBRARY__ */
|
||||
extern int getopt ();
|
||||
#endif /* __GNU_LIBRARY__ */
|
||||
#endif
|
||||
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
||||
const struct option *longopts, int *longind);
|
||||
extern int getopt_long_only (int argc, char *const *argv,
|
||||
|
|
2
main.cpp
2
main.cpp
|
@ -500,6 +500,8 @@ static void ShowVersion ()
|
|||
"-x86"
|
||||
#elif defined(__amd64__)
|
||||
"-amd64"
|
||||
#elif defined(__ppc__)
|
||||
"-ppc"
|
||||
#endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
2
tarray.h
2
tarray.h
|
@ -37,7 +37,9 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#ifndef __APPLE__
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <new>
|
||||
|
||||
// TArray -------------------------------------------------------------------
|
||||
|
|
51
zdbsp.h
51
zdbsp.h
|
@ -119,7 +119,7 @@ inline fixed_t DMulScale32 (fixed_t a, fixed_t b, fixed_t c, fixed_t d)
|
|||
|
||||
#pragma warning (default: 4035)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
#elif defined(__GNUC__) && defined(__i386__)
|
||||
|
||||
#ifdef __clang__
|
||||
inline fixed_t Scale (fixed_t a, fixed_t b, fixed_t c)
|
||||
|
@ -231,8 +231,51 @@ inline fixed_t DMulScale32 (fixed_t a, fixed_t b, fixed_t c, fixed_t d)
|
|||
|
||||
#endif
|
||||
|
||||
// FIXME: No macros defined for big-endian machines.
|
||||
#define LittleShort(x) (x)
|
||||
#define LittleLong(x) (x)
|
||||
#ifdef __APPLE__
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#define LittleShort(x) CFSwapInt16LittleToHost(x)
|
||||
#define LittleLong(x) CFSwapInt32LittleToHost(x)
|
||||
#else
|
||||
#ifdef __BIG_ENDIAN__
|
||||
|
||||
// Swap 16bit, that is, MSB and LSB byte.
|
||||
// No masking with 0xFF should be necessary.
|
||||
inline short LittleShort (short x)
|
||||
{
|
||||
return (short)((((unsigned short)x)>>8) | (((unsigned short)x)<<8));
|
||||
}
|
||||
|
||||
inline unsigned short LittleShort (unsigned short x)
|
||||
{
|
||||
return (unsigned short)((x>>8) | (x<<8));
|
||||
}
|
||||
|
||||
// Swapping 32bit.
|
||||
inline unsigned int LittleLong (unsigned int x)
|
||||
{
|
||||
return (unsigned int)(
|
||||
(x>>24)
|
||||
| ((x>>8) & 0xff00)
|
||||
| ((x<<8) & 0xff0000)
|
||||
| (x<<24));
|
||||
}
|
||||
|
||||
inline int LittleLong (int x)
|
||||
{
|
||||
return (int)(
|
||||
(((unsigned int)x)>>24)
|
||||
| ((((unsigned int)x)>>8) & 0xff00)
|
||||
| ((((unsigned int)x)<<8) & 0xff0000)
|
||||
| (((unsigned int)x)<<24));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define LittleShort(x) (x)
|
||||
#define LittleLong(x) (x)
|
||||
|
||||
#endif // __BIG_ENDIAN__
|
||||
#endif // __APPLE__
|
||||
|
||||
#endif //__ZDBSP_H__
|
||||
|
|
Loading…
Reference in a new issue