OSX needs to calculate endianness mid-compilation; it can't be passed on compile command since one gcc invocation can produce both ppc and intel binaries

This commit is contained in:
David Schmidt 2012-02-29 17:37:44 +00:00
parent 8644685329
commit 8159606d9a
7 changed files with 14 additions and 14 deletions

View File

@ -183,7 +183,7 @@ clk_calculate_bram_checksum(void) {
}
checksum &= 0xFFFF;
checksum += ((checksum ^ 0xAAAA) << 16);
#ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
g_bram_ptr[252] = (checksum & 0xFF);
g_bram_ptr[253] = (checksum >> 8);
g_bram_ptr[254] = (checksum >> 16);

View File

@ -1898,7 +1898,7 @@ iwm_nibblize_track_525(Disk *dsk, Trk *trk, byte *track_buf, int qtr_track)
word_ptr = (word32 *)&(trk->nib_area[0]);
#ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
val = 0xff08ff08;
#else
val = 0x08ff08ff;
@ -2003,7 +2003,7 @@ iwm_nibblize_track_35(Disk *dsk, Trk *trk, byte *track_buf, int qtr_track)
int i;
word_ptr = (word32 *)&(trk->nib_area[0]);
#ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__)
val = 0xff08ff08;
#else
val = 0x08ff08ff;

View File

@ -642,7 +642,7 @@ do_write_c7(int unit_num, word32 buf, int blk)
val1 = get_memory16_c(buf + i, 0);
val2 = get_memory16_c(buf + i + 2, 0);
/* reorder the little-endian bytes to be big-endian */
#ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
val = (val2 << 16) + val1;
#else
val = (val1 << 24) + ((val1 << 8) & 0xff0000) +

View File

@ -1,6 +1,6 @@
/*
GSport - an Apple //gs Emulator
Copyright (C) 2010 by GSport contributors
Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -1058,7 +1058,7 @@ sound_play(double dsamps)
#if defined(__linux__) || defined(OSS)
/* Linux seems to expect little-endian */
/* samples always, even on PowerPC */
# ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
sndptr[pos] = (val << 16) + (val0 & 0xffff);
# else
sndptr[pos] = ((val & 0xff) << 24) +
@ -1067,7 +1067,7 @@ sound_play(double dsamps)
((val0 >> 8) & 0xff);
# endif
#else
# ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
sndptr[pos] = (val << 16) + (val0 & 0xffff);
# else
sndptr[pos] = (val0 << 16) + (val & 0xffff);

View File

@ -1,6 +1,6 @@
/*
GSport - an Apple //gs Emulator
Copyright (C) 2010 by GSport contributors
Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -398,7 +398,7 @@ child_sound_init_linux()
exit(1);
}
#ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
fmt = AFMT_S16_LE;
#else
fmt = AFMT_S16_BE;

View File

@ -1,6 +1,6 @@
/*
GSport - an Apple //gs Emulator
Copyright (C) 2010 by GSport contributors
Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -516,7 +516,7 @@ video_init()
val1 = g_dhires_colors_16[col[1] & 0xf];
val2 = g_dhires_colors_16[col[2] & 0xf];
val3 = g_dhires_colors_16[col[3] & 0xf];
#ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
val = (val3 << 24) + (val2 << 16) + (val1 << 8) + val0;
#else
val = (val0 << 24) + (val1 << 16) + (val2 << 8) + val3;
@ -1622,7 +1622,7 @@ redraw_changed_gr(int start_offset, int start_line, int num_lines, int reparse,
(val0 << 8) + val0;
val1_wd = (val1 << 24) + (val1 << 16) +
(val1 << 8) + val1;
#ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
val01_wd = (val1_wd << 16) + (val0_wd & 0xffff);
#else
val01_wd = (val0_wd << 16) + (val1_wd & 0xffff);
@ -1762,7 +1762,7 @@ redraw_changed_dbl_gr(int start_offset, int start_line, int num_lines,
(val2 << 8) + val2;
val3_wd = (val3 << 24) + (val3 << 16) +
(val3 << 8) + val3;
#ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
val01_wd = (val1_wd << 24) + (val0_wd&0xffffff);
val12_wd = (val2_wd << 16) + (val1_wd & 0xffff);
val23_wd = (val3_wd << 8) + (val2_wd & 0xff);

View File

@ -895,7 +895,7 @@ get_ximage(Kimage *kimage_ptr)
xim = XCreateImage(g_display, g_vis, depth, ZPixmap, 0,
(char *)ptr, width, height, 8, 0);
#ifdef GSPORT_LITTLE_ENDIAN
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
xim->byte_order = LSBFirst;
#else
xim->byte_order = MSBFirst;