fixing the compile and the floating point error

This commit is contained in:
Vincent Batts 2012-11-19 18:22:29 -05:00
parent 8de884e177
commit 4ccc79ed1e
3 changed files with 14 additions and 10 deletions

View File

@ -1,8 +1,9 @@
MUSIC_FILES := $(basename $(wildcard f*.c)) MUSIC_FILES := $(basename $(wildcard f*.c)) main
TMP_FILES := $(wildcard *~) $(wildcard *.o) TMP_FILES := $(wildcard *~) $(wildcard *.o)
CFLAGS += CFLAGS +=
LDFLAGS += -static -s LDFLAGS += -g
CC = gcc
all: $(MUSIC_FILES) all: $(MUSIC_FILES)
audio.o: audio.c audio.h audio.o: audio.c audio.h

View File

View File

@ -23,9 +23,9 @@ int sound_3(int t) {
int sound_4(int t) { int sound_4(int t) {
int i = 0; int i = 0;
while (i == 0) { i = (t>>7-(t>>15)&-t>>7-(t>>15));
i = (t>>7-(t>>15)&-t>>7-(t>>15)); if (i==0) {
t++; i=1;
} }
return (t>>4|t&(t>>5)/i); return (t>>4|t&(t>>5)/i);
} }
@ -37,10 +37,13 @@ int sound_5(int t) {
int sound_6(int t) { int sound_6(int t) {
int y = 0, x = 0; int y = 0, x = 0;
while (y == 0 && x == 0) { x=t*"6689"[t>>16&3]/24&127;
x=t*"6689"[t>>16&3]/24&127; y=t&16383;
y=t&16383; if (y==0) {
t++; y=1;
}
if (x==0) {
y=1;
} }
return ((30000000000/(y)&1)*35+(x)*y/400000000+((t>>8^t>>10|1>>14|x)&63)); return ((30000000000/(y)&1)*35+(x)*y/400000000+((t>>8^t>>10|1>>14|x)&63));
} }