Skip to content

Commit

Permalink
Merge pull request #19 from stsp/lto
Browse files Browse the repository at this point in the history
Lto
  • Loading branch information
stsp authored Oct 23, 2024
2 parents e8ad110 + 0296c97 commit 97ffabd
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 64 deletions.
37 changes: 19 additions & 18 deletions include/float.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,53 @@
#define __dj_include_float_h_

#include <libc/asmobj.h>
#include <libc/ieee.h>

#ifdef __cplusplus
extern "C" {
#endif

extern float __dj_float_epsilon;
extern float __dj_float_max;
extern float __dj_float_min;
extern _float_union_t __dj_float_epsilon;
extern _float_union_t __dj_float_max;
extern _float_union_t __dj_float_min;

#define FLT_DIG 6
#define FLT_EPSILON __dj_float_epsilon
#define FLT_EPSILON __dj_float_epsilon.f
#define FLT_MANT_DIG 24
#define FLT_MAX __dj_float_max
#define FLT_MAX __dj_float_max.f
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN __dj_float_min
#define FLT_MIN __dj_float_min.f
#define FLT_MIN_10_EXP (-37)
#define FLT_MIN_EXP (-125)
#define FLT_RADIX 2
#define FLT_ROUNDS 1

extern double __dj_double_epsilon;
extern double __dj_double_max;
extern double __dj_double_min;
extern _double_union_t __dj_double_epsilon;
extern _double_union_t __dj_double_max;
extern _double_union_t __dj_double_min;

#define DBL_DIG 15
#define DBL_EPSILON __dj_double_epsilon
#define DBL_EPSILON __dj_double_epsilon.d
#define DBL_MANT_DIG 53
#define DBL_MAX __dj_double_max
#define DBL_MAX __dj_double_max.d
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN __dj_double_min
#define DBL_MIN __dj_double_min.d
#define DBL_MIN_10_EXP (-307)
#define DBL_MIN_EXP (-1021)

extern long double __dj_long_double_epsilon;
extern long double __dj_long_double_max;
extern long double __dj_long_double_min;
extern _longdouble_union_t __dj_long_double_epsilon;
extern _longdouble_union_t __dj_long_double_max;
extern _longdouble_union_t __dj_long_double_min;

#define LDBL_DIG 18
#define LDBL_EPSILON __dj_long_double_epsilon
#define LDBL_EPSILON __dj_long_double_epsilon.ld
#define LDBL_MANT_DIG 64
#define LDBL_MAX __dj_long_double_max
#define LDBL_MAX __dj_long_double_max.ld
#define LDBL_MAX_10_EXP 4932
#define LDBL_MAX_EXP 16384
#define LDBL_MIN __dj_long_double_min
#define LDBL_MIN __dj_long_double_min.ld
#define LDBL_MIN_10_EXP (-4931)
#define LDBL_MIN_EXP (-16381)

Expand Down
25 changes: 0 additions & 25 deletions include/libc/_ansi

This file was deleted.

18 changes: 10 additions & 8 deletions include/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
extern "C" {
#endif

#include <libc/ieee.h>

#ifndef __dj_ENFORCE_ANSI_FREESTANDING

extern double __dj_huge_val;
extern _double_union_t __dj_huge_val;

#define HUGE_VAL __dj_huge_val
#define HUGE_VAL __dj_huge_val.d

double acos(double _x);
double asin(double _x);
Expand Down Expand Up @@ -96,16 +98,16 @@ extern long double frexpl(long double, int *);
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
|| !defined(__STRICT_ANSI__) || defined(__cplusplus)

extern float __dj_huge_valf;
extern long double __dj_huge_vall;
extern _float_union_t __dj_huge_valf;
extern _longdouble_union_t __dj_huge_vall;

#define HUGE_VALF __dj_huge_valf
#define HUGE_VALL __dj_huge_vall
#define HUGE_VALF __dj_huge_valf.f
#define HUGE_VALL __dj_huge_vall.ld

#define INFINITY HUGE_VALF

extern float __dj_nan;
#define NAN __dj_nan
extern _float_union_t __dj_nan;
#define NAN __dj_nan.f

#define FP_INFINITE 0x00000001
#define FP_NAN 0x00000002
Expand Down
2 changes: 1 addition & 1 deletion src/libc/ansi/math/huge_val.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

double_t __dj_huge_val = { 0x00000, 0x00000, 0x7ff, 0x0 };
_double_union_t __dj_huge_val = { .dt = { 0x00000, 0x00000, 0x7ff, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/ansif/float/float_de.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

double_t __dj_double_epsilon = { 0x00000000, 0x00000, 0x3cb, 0x0 };
_double_union_t __dj_double_epsilon = { .dt = { 0x00000000, 0x00000, 0x3cb, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/ansif/float/float_dm.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

double_t __dj_double_min = { 0x00000000, 0x00000, 0x001, 0x0 };
_double_union_t __dj_double_min = { .dt = { 0x00000000, 0x00000, 0x001, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/ansif/float/float_dx.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

double_t __dj_double_max = { 0xffffffffU, 0xfffff, 0x7fe, 0x0 };
_double_union_t __dj_double_max = { .dt = { 0xffffffffU, 0xfffff, 0x7fe, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/ansif/float/float_fe.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

float_t __dj_float_epsilon = { 0x000000, 0x68, 0x0 };
_float_union_t __dj_float_epsilon = { .ft = { 0x000000, 0x68, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/ansif/float/float_fm.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

float_t __dj_float_min = { 0x000000, 0x01, 0x0 };
_float_union_t __dj_float_min = { .ft = { 0x000000, 0x01, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/ansif/float/float_fx.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

float_t __dj_float_max = { 0x7fffff, 0xfe, 0x0 };
_float_union_t __dj_float_max = { .ft = { 0x7fffff, 0xfe, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/ansif/float/float_le.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

long_double_t __dj_long_double_epsilon = { 0x00000000, 0x80000000U, 0x3fc0, 0x0 };
_longdouble_union_t __dj_long_double_epsilon = { .ldt = { 0x00000000, 0x80000000U, 0x3fc0, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/ansif/float/float_lm.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

long_double_t __dj_long_double_min = { 0x00000000, 0x80000000U, 0x0001, 0x0 };
_longdouble_union_t __dj_long_double_min = { .ldt = { 0x00000000, 0x80000000U, 0x0001, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/ansif/float/float_lx.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

long_double_t __dj_long_double_max = { 0xffffffffU, 0xffffffffU, 0x7ffe, 0x0 };
_longdouble_union_t __dj_long_double_max = { .ldt = { 0xffffffffU, 0xffffffffU, 0x7ffe, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/c99/math/hugevalf.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

float_t __dj_huge_valf = { 0x00000, 0xff, 0x0 };
_float_union_t __dj_huge_valf = { .ft = { 0x00000, 0xff, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/c99/math/hugevall.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

long_double_t __dj_huge_vall = { 0x00000000, 0x80000000, 0x7fff, 0x0 };
_longdouble_union_t __dj_huge_vall = { .ldt = { 0x00000000, 0x80000000, 0x7fff, 0x0 } };
2 changes: 1 addition & 1 deletion src/libc/c99/math/nan_def.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
#include <libc/ieee.h>

float_t __dj_nan = { 0x7fffff, 0xff, 0x0 };
_float_union_t __dj_nan = { .ft = { 0x7fffff, 0xff, 0x0 } };
1 change: 1 addition & 0 deletions src/makefile.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ gcc.opt: makefile.cfg
@echo "-fno-common" >>$@
@echo "-fpic" >>$@
@echo "-ffreestanding" >>$@
@echo "-flto=auto" >>$@
@echo "-nostdinc" >>$@
@echo "-ggdb3" >>$@
@echo "-Og" >>$@
Expand Down

0 comments on commit 97ffabd

Please sign in to comment.