Skip to content

Commit

Permalink
Match and link ansi_fp.c
Browse files Browse the repository at this point in the history
  • Loading branch information
Antidote committed Oct 31, 2024
1 parent 82e6475 commit 4b972d2
Show file tree
Hide file tree
Showing 6 changed files with 626 additions and 7 deletions.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def MatchingFor(*versions):
Object(Matching, "Runtime/abort_exit.c"),
Object(NonMatching, "Runtime/alloc.c"),
Object(Matching, "Runtime/ansi_files.c"),
Object(NonMatching, "Runtime/ansi_fp.c"),
Object(Matching, "Runtime/ansi_fp.c"),
Object(Matching, "Runtime/arith.c"),
Object(Matching, "Runtime/buffer_io.c"),
Object(Matching, "Runtime/ctype.c"),
Expand Down
2 changes: 1 addition & 1 deletion include/Kyoto/Math/CVector3f.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class CVector3f {
const float& operator[](EDimZ) const { return mZ; }

float& operator[](int i) { return (&mX)[i]; }
float operator[](int i) const { return (&mX)[i]; }
const float operator[](int i) const { return (&mX)[i]; }
bool IsNonZero() const { return mX != 0.f || mY != 0.f || mZ != 0.f; }

CVector3f DropZ() const { return CVector3f(mX, mY, 0.f); }
Expand Down
6 changes: 6 additions & 0 deletions libc/float.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
extern "C" {
#endif

#define FLT_DIG 6
#define FLT_MAX 3.402823466e+38f
#define FLT_EPSILON 1.192092896e-07f
#define FLT_MIN 1.175494351e-38f

#define DBL_DIG 6
#define DBL_MIN 5.8774717e-39
#define DBL_MAX (* (double *) __double_max)
#define DBL_EPSILON 1.1920929e-07

#define DBL_MANT_DIG 53

#ifdef __cplusplus
}
#endif
Expand Down
13 changes: 9 additions & 4 deletions libc/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ extern _INT32 __float_huge[];
extern _INT32 __float_nan[];
extern _INT32 __double_huge[];
extern _INT32 __extended_huge[];
extern _INT32 __double_max[];

#define HUGE_VAL (*(double*)__double_huge)
#define INFINITY (*(float*)__float_huge)
Expand Down Expand Up @@ -111,6 +112,8 @@ _MATH_INLINE float powf(float __x, float __y) { return pow(__x, __y); }
#define __UHI(x) (*(_UINT32*)&x)
#endif

#define signbit(x)((int)(__HI(x)&0x80000000))

#define FP_NAN 1
#define FP_INFINITE 2
#define FP_ZERO 3
Expand Down Expand Up @@ -204,14 +207,16 @@ float sqrtf(float x);
double sqrt(double x);
#endif

static inline float ldexpf(float x, int exp) { return (float)ldexp((double)x, exp); }
static inline double scalbn(double x, int n) { return ldexp(x, n); }
static inline float scalbnf(float x, int n) { return (float)ldexpf(x, n); }

#ifdef __MWERKS__
#pragma cplusplus reset
#endif

static inline float ldexpf(float x, int exp) { return (float)ldexp((double)x, exp); }
double frexp(double, int *exp);
static inline double scalbn(double x, int n) { return ldexp(x, n); }
static inline float scalbnf(float x, int n) { return (float)ldexpf(x, n); }
double nextafter(double, double);

#ifdef __cplusplus
}
#endif
Expand Down
9 changes: 8 additions & 1 deletion src/Kyoto/Text/CWordBreakTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
struct CCharacterIdentifier {
wchar_t chr;
uint rank;

struct Compare {
bool operator()(const CCharacterIdentifier& ident, wchar_t chr) { return ident.chr == chr; }
bool operator()(wchar_t chr, const CCharacterIdentifier& ident) { return chr == ident.chr; }
};
};

const CCharacterIdentifier gCantBeginChars[63] = {
Expand All @@ -21,7 +26,7 @@ const CCharacterIdentifier gCantBeginChars[63] = {

const CCharacterIdentifier gCantEndChars[89] = {
{L'#', 2}, {L'$', 2}, {L'(', 1}, {L'@', 2}, {L'B', 4}, {L'C', 4}, {L'D', 4},
{L'E', 4}, {L'F', 4}, {L'G', 4}, {L'J', 4}, {L'K', 4}, {L'L', 4}, {L'M', 4},
{L'F', 4}, {L'G', 4}, {L'H', 4}, {L'J', 4}, {L'K', 4}, {L'L', 4}, {L'M', 4},
{L'N', 4}, {L'P', 4}, {L'Q', 4}, {L'R', 4}, {L'S', 4}, {L'T', 4}, {L'V', 4},
{L'W', 4}, {L'X', 4}, {L'Y', 4}, {L'Z', 4}, {L'b', 4}, {L'c', 4}, {L'd', 4},
{L'f', 4}, {L'g', 4}, {L'h', 4}, {L'j', 4}, {L'k', 4}, {L'l', 4}, {L'm', 4},
Expand All @@ -36,4 +41,6 @@ const CCharacterIdentifier gCantEndChars[89] = {
};

int CWordBreakTables::GetBeginRank(wchar_t chr) {
//rstl::binary_find(&gCantBeginChars[0], &gCantBeginChars[62], chr, CCharacterIdentifier::Compare());
return -1;
}
Loading

0 comments on commit 4b972d2

Please sign in to comment.