Skip to content

Commit c38adc1

Browse files
authored
Add NO_SQRTF_INTRINSIC for z_rumble.c and audio/general.c (zeldaret#2067)
1 parent 98ba7ad commit c38adc1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,10 @@ $(BUILD_DIR)/src/code/fault_drawer.o: CFLAGS += -trapuv
425425
$(BUILD_DIR)/src/code/fault_drawer.o: OPTFLAGS := -O2 -g3
426426
$(BUILD_DIR)/src/code/ucode_disas.o: OPTFLAGS := -O2 -g3
427427

428+
ifeq ($(PLATFORM),N64)
429+
$(BUILD_DIR)/src/code/z_rumble.o: CFLAGS += -DNO_SQRTF_INTRINSIC
430+
endif
431+
428432
ifeq ($(DEBUG),1)
429433
$(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -g
430434
else
@@ -436,6 +440,10 @@ $(BUILD_DIR)/src/audio/%.o: OPTFLAGS := -O2
436440
# Use signed chars instead of unsigned for this audio file (needed to match AudioDebug_ScrPrt)
437441
$(BUILD_DIR)/src/audio/general.o: CFLAGS += -signed
438442

443+
ifeq ($(PLATFORM),N64)
444+
$(BUILD_DIR)/src/audio/general.o: CFLAGS += -DNO_SQRTF_INTRINSIC
445+
endif
446+
439447
# Put string literals in .data for some audio files (needed to match these files with literals)
440448
$(BUILD_DIR)/src/audio/sfx.o: CFLAGS += -use_readwrite_const
441449
$(BUILD_DIR)/src/audio/sequence.o: CFLAGS += -use_readwrite_const

include/libc/math.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ f32 fabsf(f32 f);
4242
#endif
4343

4444
f32 sqrtf(f32 f);
45-
#ifdef __sgi
45+
// IDO has a sqrtf intrinsic, but in N64 versions it's not used for some files.
46+
// For these files we define NO_SQRTF_INTRINSIC to use the sqrtf function instead.
47+
#if defined(__sgi) && !defined(NO_SQRTF_INTRINSIC)
4648
#pragma intrinsic(sqrtf)
4749
#endif
4850

0 commit comments

Comments
 (0)