Merge pull request #173 from orbea/build

Allow building with gcc.
This commit is contained in:
Lior Halphon 2019-05-10 14:13:55 +03:00 committed by GitHub
commit 6ad8e30f88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -69,7 +69,9 @@ static void update_sample(GB_gameboy_t *gb, unsigned index, int8_t value, unsign
static void render(GB_gameboy_t *gb, bool no_downsampling, GB_sample_t *dest)
{
GB_sample_t output = {0,0};
#ifdef __clang__
#pragma unroll
#endif
for (unsigned i = GB_N_CHANNELS; i--;) {
double multiplier = CH_STEP;
if (!is_DAC_enabled(gb, i)) {
@ -126,7 +128,9 @@ static void render(GB_gameboy_t *gb, bool no_downsampling, GB_sample_t *dest)
unsigned mask = gb->io_registers[GB_IO_NR51];
unsigned left_volume = 0;
unsigned right_volume = 0;
#ifdef __clang__
#pragma unroll
#endif
for (unsigned i = GB_N_CHANNELS; i--;) {
if (gb->apu.is_active[i]) {
if (mask & 1) {
@ -374,7 +378,9 @@ void GB_apu_run(GB_gameboy_t *gb)
}
}
#ifdef __clang__
#pragma unroll
#endif
for (unsigned i = GB_SQUARE_2 + 1; i--;) {
if (gb->apu.is_active[i]) {
uint8_t cycles_left = cycles;

View File

@ -27,7 +27,9 @@ static GB_fifo_item_t *fifo_pop(GB_fifo_t *fifo)
static void fifo_push_bg_row(GB_fifo_t *fifo, uint8_t lower, uint8_t upper, uint8_t palette, bool bg_priority, bool flip_x)
{
if (!flip_x) {
#ifdef __clang__
#pragma unroll
#endif
for (unsigned i = 8; i--;) {
fifo->fifo[fifo->write_end] = (GB_fifo_item_t) {
(lower >> 7) | ((upper >> 7) << 1),
@ -43,7 +45,9 @@ static void fifo_push_bg_row(GB_fifo_t *fifo, uint8_t lower, uint8_t upper, uint
}
}
else {
#ifdef __clang__
#pragma unroll
#endif
for (unsigned i = 8; i--;) {
fifo->fifo[fifo->write_end] = (GB_fifo_item_t) {
(lower & 1) | ((upper & 1) << 1),
@ -70,7 +74,9 @@ static void fifo_overlay_object_row(GB_fifo_t *fifo, uint8_t lower, uint8_t uppe
uint8_t flip_xor = flip_x? 0: 0x7;
#ifdef __clang__
#pragma unroll
#endif
for (unsigned i = 8; i--;) {
uint8_t pixel = (lower >> 7) | ((upper >> 7) << 1);
GB_fifo_item_t *target = &fifo->fifo[(fifo->read_end + (i ^ flip_xor)) & (GB_FIFO_LENGTH - 1)];
@ -1117,7 +1123,9 @@ uint8_t GB_get_oam_info(GB_gameboy_t *gb, GB_oam_info_t *dest, uint8_t *sprite_h
}
for (unsigned y = 0; y < *sprite_height; y++) {
#ifdef __clang__
#pragma unroll
#endif
for (unsigned x = 0; x < 8; x++) {
uint8_t color = (((gb->vram[vram_address ] >> ((~x)&7)) & 1 ) |
((gb->vram[vram_address + 1] >> ((~x)&7)) & 1) << 1 );

View File

@ -44,9 +44,11 @@ endif
# Set tools
# Use clang if it's available.
ifeq ($(origin CC),default)
ifneq (, $(shell which clang))
CC := clang
endif
endif
ifeq ($(PLATFORM),windows32)
# To force use of the Unix version instead of the Windows version