Skip to content

Commit

Permalink
allow omitting fixuns(s/d)fsi, which may be provided by gcc already
Browse files Browse the repository at this point in the history
  • Loading branch information
ant6n committed Sep 21, 2019
1 parent 40088bc commit 8753324
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ SRC_DIR := src
BIN_DIR := bin

CC := gcc
C_FLAGS := -c -O2 -msoft-float
C_FLAGS := -c -O2 -msoft-float
# The INCLUDE must provide the required header files (longlong.h etc.), in the form INCLUDE=I<dir>
INCLUDE :=
AR := ar
OUTPUT := libsoft-fp.a
Expand All @@ -13,7 +14,8 @@ SRC_FILES := $(patsubst %, $(GEN_DIR)/%.c, $(FILES))
OBJ_FILES := $(patsubst %, $(BIN_DIR)/%.o, $(FILES))

# defintions
BIG_ENDIAN := 0
BIG_ENDIAN := 0
OMIT_FIXUNSFFSI := 0

# Definitions for float types and operations
F_COMPUTE_TYPE := unsigned long
Expand Down Expand Up @@ -60,6 +62,9 @@ $(GEN_DIR)/sfieeelib.c: $(SRC_DIR)/ieeelib.c
echo '#define MSB_IMPLICIT true' >>$(GEN_DIR)/sfieeelib.c
ifeq ($(BIG_ENDIAN),1)
echo '#define FLOAT_WORDS_BIG_ENDIAN' >>$(GEN_DIR)/sfieeelib.c
endif
ifeq ($(OMIT_FIXUNSFFSI),1)
echo '#define OMIT_FIXUNSFFSI' >>$(GEN_DIR)/sfieeelib.c
endif
cat $(SRC_DIR)/ieeelib.c >>$(GEN_DIR)/sfieeelib.c

Expand All @@ -76,6 +81,9 @@ $(GEN_DIR)/dfieeelib.c: $(SRC_DIR)/ieeelib.c
echo '#define MSB_IMPLICIT true' >>$(GEN_DIR)/dfieeelib.c
ifeq ($(BIG_ENDIAN),1)
echo '#define FLOAT_WORDS_BIG_ENDIAN' >>$(GEN_DIR)/sfieeelib.c
endif
ifeq ($(OMIT_FIXUNSFFSI),1)
echo '#define OMIT_FIXUNSFFSI' >>$(GEN_DIR)/sfieeelib.c
endif
cat $(SRC_DIR)/ieeelib.c >>$(GEN_DIR)/dfieeelib.c

Expand Down
4 changes: 4 additions & 0 deletions src/ieeelib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1945,6 +1945,7 @@ fixfpsi_2 (FLOATING_TYPE u)
#endif
/*-----------------------------------------------------------------------------------------*/
#ifdef fixunsfpsi_1
#ifndef OMIT_FIXUNSFFSI
USItype
fixunsfpsi_1 (FLOATING_TYPE u)
{
Expand All @@ -1961,8 +1962,10 @@ fixunsfpsi_1 (FLOATING_TYPE u)
return ((um | UP_MSB) >> (COMPUTE_TYPE_BITS - 1 - ue));
}
#endif
#endif

#ifdef fixunsfpsi_2
#ifndef OMIT_FIXUNSFFSI
USItype
fixunsfpsi_2 (FLOATING_TYPE u)
{
Expand All @@ -1979,6 +1982,7 @@ fixunsfpsi_2 (FLOATING_TYPE u)
return ((uh | UP_MSB) >> (COMPUTE_TYPE_BITS - 1 - ue));
}
#endif
#endif

/*-----------------------------------------------------------------------------------------*/
#define N_QUOTIENT_BITS (MANTISSA_BITS+1)
Expand Down

0 comments on commit 8753324

Please sign in to comment.