Skip to content

Commit

Permalink
Define qfldbl and ldbl_to_q only for x87 code.
Browse files Browse the repository at this point in the history
These two functions assume x87 80-bit representation.
  • Loading branch information
ldesnogu committed Sep 1, 2024
1 parent 26fbdbb commit 3d72c2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/qfloat.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ double dbl_flip_lsb(double d)
return u64_to_f64(c);
}

#ifdef X87_ASM
/* qfloat --> long double conversion utility.
Example: x = QLN2:
hi = 0x3fe62e42fefa39ef,
Expand Down Expand Up @@ -430,6 +431,7 @@ struct qfloat ldbl_to_q(long double x)
q.lo = (x87_mant<<53);
return q;
}
#endif


/* Convert IEEE64 double to qfloat. */
Expand Down
4 changes: 2 additions & 2 deletions src/qfloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ uint64 qfdbl_as_uint64(const struct qfloat q);
double qfdbl (const struct qfloat q);
double qfdbl_wrong_way_rnd(struct qfloat q);
double dbl_flip_lsb (double d);
long double qfldbl (const struct qfloat q);
long double qfldbl (const struct qfloat q); // This should only be used for x87 code.
// double / long-double --> qfloat conversions:
struct qfloat dbl_to_q (double d);
struct qfloat ldbl_to_q (long double ld);
struct qfloat ldbl_to_q (long double ld); // This should only be used for x87 code.
// int --> qfloat conversion:
struct qfloat i64_to_q (int64 i64);
struct qfloat i128_to_q (uint128 i);
Expand Down

0 comments on commit 3d72c2b

Please sign in to comment.