diff options
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h index 0d6c89f..bbe6b52 100644 --- a/src/common.h +++ b/src/common.h | |||
@@ -419,12 +419,16 @@ dma_transfer_fill(void *dst, volatile u32 src, u32 count, int channel, u32 optio | |||
419 | inline void | 419 | inline void |
420 | dma_copy(void *dst, const void *src, u32 size, int channel) { | 420 | dma_copy(void *dst, const void *src, u32 size, int channel) { |
421 | dma_transfer_copy(dst, src, size / 4, channel, DMA_CHUNK_32 | DMA_ENABLE); | 421 | dma_transfer_copy(dst, src, size / 4, channel, DMA_CHUNK_32 | DMA_ENABLE); |
422 | // Stall for 2 cycles in case we call this function more than once. | ||
423 | asm("nop"); asm("nop"); | ||
422 | } | 424 | } |
423 | 425 | ||
424 | // Fill the dst location with the word set at src. | 426 | // Fill the dst location with the word set at src. |
425 | inline void | 427 | inline void |
426 | dma_fill(void *dst, vu32 src, u32 size, int channel) { | 428 | dma_fill(void *dst, vu32 src, u32 size, int channel) { |
427 | dma_transfer_fill(dst, src, size / 4, channel, DMA_CHUNK_32 | DMA_ENABLE); | 429 | dma_transfer_fill(dst, src, size / 4, channel, DMA_CHUNK_32 | DMA_ENABLE); |
430 | // Stall for 2 cycles in case we call this function more than once. | ||
431 | asm("nop"); asm("nop"); | ||
428 | } | 432 | } |
429 | 433 | ||
430 | // | 434 | // |
@@ -731,6 +735,7 @@ wait_vsync(void) { | |||
731 | #define LEN(ARR) (sizeof(ARR) / sizeof((ARR)[0])) | 735 | #define LEN(ARR) (sizeof(ARR) / sizeof((ARR)[0])) |
732 | 736 | ||
733 | // Fixed-point arithmetic for (i.P) numbers. | 737 | // Fixed-point arithmetic for (i.P) numbers. |
738 | #define FP_NUM(A,P) ((A) << (P)) | ||
734 | #define FP_MUL(A,B,P) (((A) * (B)) >> (P)) | 739 | #define FP_MUL(A,B,P) (((A) * (B)) >> (P)) |
735 | #define FP_DIV(A,B,P) (((A) << (P)) / (B)) | 740 | #define FP_DIV(A,B,P) (((A) << (P)) / (B)) |
736 | #define FP_LERP(Y0,Y1,X,P) ((Y0) + FP_MUL((X), ((Y1) - (Y0)), P)) | 741 | #define FP_LERP(Y0,Y1,X,P) ((Y0) + FP_MUL((X), ((Y1) - (Y0)), P)) |
@@ -745,4 +750,10 @@ wait_vsync(void) { | |||
745 | #define EWRAM_CODE __attribute__((section(".ewram"), long_call)) | 750 | #define EWRAM_CODE __attribute__((section(".ewram"), long_call)) |
746 | #define EWRAM_BSS __attribute__((section(".sbss"))) | 751 | #define EWRAM_BSS __attribute__((section(".sbss"))) |
747 | 752 | ||
753 | // | ||
754 | // Compiler hints. | ||
755 | // | ||
756 | |||
757 | #define UNROLL_LOOPS __attribute__((optimize("unroll-loops"))) | ||
758 | |||
748 | #endif // GBAEXP_COMMON_H | 759 | #endif // GBAEXP_COMMON_H |