Skip to content

Commit c271a01

Browse files
committed
Fixed fmodl and renamed softfloat functions (i.e. f64_sqrt to __f64_sqrt) to avoid conflict with user functions
1 parent 84ca507 commit c271a01

37 files changed

+344
-357
lines changed

src/crt/ddiv.src

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ __ddiv:
1717
rla
1818
push af ; Carry = (signbit(x) != signbit(y))
1919

20-
call _f64_div
20+
call ___f64_div
2121

2222
pop af, af, af, af, af
2323
pop iy, af ; restore
2424
ret
2525

26-
extern _f64_div
26+
extern ___f64_div

src/crt/dmul.src

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ __dmul:
1717
rla
1818
push af ; Carry = (signbit(x) != signbit(y))
1919

20-
call _f64_mul
20+
call ___f64_mul
2121

2222
pop af, af, af, af, af
2323
pop iy, af ; restore
2424
ret
2525

26-
extern _f64_mul
26+
extern ___f64_mul

src/crt/drem.src

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ __drem:
1414
rl b
1515
push af ; Carry = signbit(x)
1616

17-
call _f64_rem
17+
call ___f64_rem
1818

1919
pop af, af, af, af, af
2020
pop iy, af ; restore
2121
ret
2222

23-
extern _f64_rem
23+
extern ___f64_rem

src/crt/dtof.src

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
__dtof:
88
; f64_ret_f32
99
push af, iy, bc, de, hl
10-
call _f64_to_f32
10+
call ___f64_to_f32
1111
pop af
1212
ld a, e
1313
pop de
1414
ld e, a
1515
pop bc, iy, af
1616
ret
1717

18-
extern _f64_to_f32
18+
extern ___f64_to_f32

src/crt/ftod.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ __ftod:
2424
pop af, af, iy
2525
ret
2626

27-
extern __ftod_c
27+
extern __ftod_c

src/crt/lltod.src

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
__lltod:
88
; i64_ret_f64
99
push af, iy, bc, de, hl
10-
call _i64_to_f64
10+
call ___i64_to_f64
1111
pop af, af, af, iy, af
1212
ret
1313

14-
extern _i64_to_f64
14+
extern ___i64_to_f64

src/crt/ltod.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ __ltod:
4141
pop af, af, iy
4242
ret
4343

44-
extern __ultod_c, __lneg
44+
extern __ultod_c, __lneg

src/crt/ulltod.src

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
__ulltod:
88
; u64_ret_f64
99
push af, iy, bc, de, hl
10-
call _ui64_to_f64
10+
call ___ui64_to_f64
1111
pop af, af, af, iy, af
1212
ret
1313

14-
extern _ui64_to_f64
14+
extern ___ui64_to_f64

src/libc/float64_rounding.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ typedef union F64_pun {
1515
long double truncl(long double x) {
1616
F64_pun arg_x, ret;
1717
arg_x.flt = x;
18-
ret.soft = f64_roundToInt(arg_x.soft, softfloat_round_minMag, false);
18+
ret.soft = __f64_roundToInt(arg_x.soft, softfloat_round_minMag, false);
1919
return ret.flt;
2020
}
2121
#endif
@@ -25,7 +25,7 @@ long double truncl(long double x) {
2525
long double floorl(long double x) {
2626
F64_pun arg_x, ret;
2727
arg_x.flt = x;
28-
ret.soft = f64_roundToInt(arg_x.soft, softfloat_round_min, false);
28+
ret.soft = __f64_roundToInt(arg_x.soft, softfloat_round_min, false);
2929
return ret.flt;
3030
}
3131
#endif
@@ -35,37 +35,37 @@ long double floorl(long double x) {
3535
long double ceill(long double x) {
3636
F64_pun arg_x, ret;
3737
arg_x.flt = x;
38-
ret.soft = f64_roundToInt(arg_x.soft, softfloat_round_max, false);
38+
ret.soft = __f64_roundToInt(arg_x.soft, softfloat_round_max, false);
3939
return ret.flt;
4040
}
4141
#endif
4242

4343
long double roundevenl(long double x) {
4444
F64_pun arg_x, ret;
4545
arg_x.flt = x;
46-
ret.soft = f64_roundToInt(arg_x.soft, softfloat_round_near_even, false);
46+
ret.soft = __f64_roundToInt(arg_x.soft, softfloat_round_near_even, false);
4747
return ret.flt;
4848
}
4949

5050
long double roundl(long double x) {
5151
F64_pun arg_x, ret;
5252
arg_x.flt = x;
53-
ret.soft = f64_roundToInt(arg_x.soft, softfloat_round_near_maxMag, false);
53+
ret.soft = __f64_roundToInt(arg_x.soft, softfloat_round_near_maxMag, false);
5454
return ret.flt;
5555
}
5656

5757
/* flags handled by softfloat */
5858
long lroundl(long double x) {
5959
F64_pun arg_x;
6060
arg_x.flt = x;
61-
return f64_to_i32(arg_x.soft, softfloat_round_near_maxMag, false);
61+
return __f64_to_i32(arg_x.soft, softfloat_round_near_maxMag, false);
6262
}
6363

6464
/* flags handled by softfloat */
6565
long long llroundl(long double x) {
6666
F64_pun arg_x;
6767
arg_x.flt = x;
68-
return f64_to_i64(arg_x.soft, softfloat_round_near_maxMag, false);
68+
return __f64_to_i64(arg_x.soft, softfloat_round_near_maxMag, false);
6969
}
7070

7171
#if ( \
@@ -92,28 +92,28 @@ long long llroundl(long double x) {
9292
long double nearbyintl(long double x) {
9393
F64_pun arg_x, ret;
9494
arg_x.flt = x;
95-
ret.soft = f64_roundToInt(arg_x.soft, GET_FENV_SOFTFLOAT_ROUNDING(), false);
95+
ret.soft = __f64_roundToInt(arg_x.soft, GET_FENV_SOFTFLOAT_ROUNDING(), false);
9696
return ret.flt;
9797
}
9898

9999
/* flags handled by softfloat */
100100
long double rintl(long double x) {
101101
F64_pun arg_x, ret;
102102
arg_x.flt = x;
103-
ret.soft = f64_roundToInt(arg_x.soft, GET_FENV_SOFTFLOAT_ROUNDING(), true);
103+
ret.soft = __f64_roundToInt(arg_x.soft, GET_FENV_SOFTFLOAT_ROUNDING(), true);
104104
return ret.flt;
105105
}
106106

107107
/* flags handled by softfloat */
108108
long lrintl(long double x) {
109109
F64_pun arg_x;
110110
arg_x.flt = x;
111-
return f64_to_i32(arg_x.soft, GET_FENV_SOFTFLOAT_ROUNDING(), true);
111+
return __f64_to_i32(arg_x.soft, GET_FENV_SOFTFLOAT_ROUNDING(), true);
112112
}
113113

114114
/* flags handled by softfloat */
115115
long long llrintl(long double x) {
116116
F64_pun arg_x;
117117
arg_x.flt = x;
118-
return f64_to_i64(arg_x.soft, GET_FENV_SOFTFLOAT_ROUNDING(), true);
118+
return __f64_to_i64(arg_x.soft, GET_FENV_SOFTFLOAT_ROUNDING(), true);
119119
}

src/libc/fmodl.src

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ _fmodl:
1111

1212
ld hl, (ix + 12)
1313
push hl ; x[63:48]
14+
ld a, h
1415

1516
ld hl, (ix + 9)
1617
push hl ; x[47:24]
1718

1819
ld hl, (ix + 6)
1920
push hl ; x[23:0]
2021

21-
ld a, h
2222
rla
2323
push af ; Carry = signbit(x)
2424

25-
call _f64_rem
25+
call ___f64_rem
2626
ld sp, ix
2727
pop ix
2828
ret
2929

30-
extern _f64_rem
30+
extern ___f64_rem
3131
extern __frameset0

src/libc/sqrtl.src

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ _sqrtl:
1212
rlca
1313
inc hl
1414
ld (hl), a
15-
jq _f64_sqrt
15+
jq ___f64_sqrt
1616

17-
extern _f64_sqrt
17+
extern ___f64_sqrt

src/softfloat/f32_mulAdd.c

-60
This file was deleted.

src/softfloat/f32_to_f64.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
float64_t f32_to_f64( float32_t a )
44+
float64_t __f32_to_f64( float32_t a )
4545
{
4646
union ui32_f32 uA;
4747
uint_fast32_t uiA;

src/softfloat/f64_add.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4242
#include "internals.h"
4343
#include "softfloat.h"
4444

45-
float64_t f64_add( float64_t a, float64_t b )
45+
float64_t __f64_add( float64_t a, float64_t b )
4646
{
4747
union ui64_f64 uA;
4848
uint_fast64_t uiA;

src/softfloat/f64_div.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
float64_t f64_div( bool signZ, float64_t a, float64_t *__restrict b )
44+
float64_t __f64_div( bool signZ, float64_t a, float64_t *__restrict b )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

src/softfloat/f64_mul.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
float64_t f64_mul( bool signZ, float64_t a, float64_t *__restrict b )
44+
float64_t __f64_mul( bool signZ, float64_t a, float64_t *__restrict b )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

src/softfloat/f64_mulAdd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "internals.h"
4242
#include "softfloat.h"
4343

44-
float64_t f64_mulAdd( float64_t a, float64_t b, float64_t c )
44+
float64_t __f64_mulAdd( float64_t a, float64_t b, float64_t c )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

src/softfloat/f64_rem.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
float64_t f64_rem( bool signA, float64_t a, float64_t *__restrict b )
44+
float64_t __f64_rem( bool signA, float64_t a, float64_t *__restrict b )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

src/softfloat/f64_roundToInt.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
float64_t f64_roundToInt( float64_t a, uint_fast8_t roundingMode, bool exact )
44+
float64_t __f64_roundToInt( float64_t a, uint_fast8_t roundingMode, bool exact )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

src/softfloat/f64_sqrt.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
float64_t f64_sqrt( f64_param A )
44+
float64_t __f64_sqrt( f64_param A )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

src/softfloat/f64_sub.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4242
#include "internals.h"
4343
#include "softfloat.h"
4444

45-
float64_t f64_sub( float64_t a, float64_t b )
45+
float64_t __f64_sub( float64_t a, float64_t b )
4646
{
4747
union ui64_f64 uA;
4848
uint_fast64_t uiA;

src/softfloat/f64_to_f32.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
float32_t f64_to_f32( float64_t a )
44+
float32_t __f64_to_f32( float64_t a )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

src/softfloat/f64_to_i32.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
int_fast32_t f64_to_i32( float64_t a, uint_fast8_t roundingMode, bool exact )
44+
int_fast32_t __f64_to_i32( float64_t a, uint_fast8_t roundingMode, bool exact )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

src/softfloat/f64_to_i32_r_minMag.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
int_fast32_t f64_to_i32_r_minMag( float64_t a, bool exact )
44+
int_fast32_t __f64_to_i32_r_minMag( float64_t a, bool exact )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

src/softfloat/f64_to_i64.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "specialize.h"
4242
#include "softfloat.h"
4343

44-
int_fast64_t f64_to_i64( float64_t a, uint_fast8_t roundingMode, bool exact )
44+
int_fast64_t __f64_to_i64( float64_t a, uint_fast8_t roundingMode, bool exact )
4545
{
4646
union ui64_f64 uA;
4747
uint_fast64_t uiA;

0 commit comments

Comments
 (0)