Reorganize headers some more

This commit is contained in:
Lassi Kortela 2019-08-27 10:20:30 +03:00
parent 43b41bc8a6
commit 297e6fa13d
5 changed files with 43 additions and 43 deletions

View File

@ -47,6 +47,8 @@
#include "scheme.h"
#include "opcodes.h"
#include "../scheme-boot/boot_image.h"
static char *builtin_names[] = {

View File

@ -132,7 +132,7 @@ int isnumtok_base(char *tok, value_t *pval, int base)
if (!read_digits(tok + 1, &end, base, &ui64)) {
return 0;
}
if (ui64 >= 0x8000000000000000ULL) {
if (ui64 >= UINT64_TOP_BIT) {
lerror(ArgError, "Number too negative");
}
if (pval)

View File

@ -15,6 +15,10 @@
//
// We assume the LP64 convention for 64-bit platforms.
#ifdef __DJGPP__
#include "scheme_compiler_djgpp.h"
#endif
#ifdef __DMC__
#include "scheme_compiler_dmc.h"
#endif
@ -31,14 +35,6 @@
#include "scheme_compiler_watcomc.h"
#endif
#ifdef BITS64
#define TOP_BIT 0x8000000000000000
#define NBITS 64
#else
#define TOP_BIT 0x80000000
#define NBITS 32
#endif
#define ALIGN(x, sz) (((x) + (sz - 1)) & (-sz))
extern double D_PNAN;
@ -769,6 +765,12 @@ typedef enum {
#define N_NUMTYPES ((int)T_DOUBLE + 1)
#ifdef BITS64
#define T_FIXNUM T_INT64
#else
#define T_FIXNUM T_INT32
#endif
value_t relocate_lispvalue(value_t v);
void print_traverse(value_t v);
void fl_print_chr(char c, struct ios *f);
@ -995,6 +997,4 @@ value_t fl_stringp(value_t *args, uint32_t nargs);
value_t fl_string_reverse(value_t *args, uint32_t nargs);
value_t fl_string_sub(value_t *args, uint32_t nargs);
#include "opcodes.h"
#include "htableh_inc.h"

View File

@ -2,12 +2,34 @@ typedef uintptr_t value_t;
typedef uintptr_t ufixnum_t;
typedef intptr_t fixnum_t;
#define BITS64
#ifdef BITS64
#define T_FIXNUM T_INT64
#define UINT64_TOP_BIT 0x8000000000000000ULL
#define TOP_BIT UINT64_TOP_BIT
#else
#define T_FIXNUM T_INT32
#define UINT32_TOP_BIT 0x80000000
#define TOP_BIT UINT32_TOP_BIT
#endif
#define DBL_MAXINT 9007199254740992LL
#define FLT_MAXINT 16777216
#define U64_MAX 18446744073709551615ULL
#define S64_MAX 9223372036854775807LL
#define S64_MIN (-S64_MAX - 1LL)
#define BIT63 0x8000000000000000LL
#define BIT31 0x80000000
#define LOG2_10 3.3219280948873626
#define sign_bit(r) ((*(int64_t *)&(r)) & BIT63)
#define NBABS(n, nb) (((n) ^ ((n) >> ((nb)-1))) - ((n) >> ((nb)-1)))
#define DFINITE(d) \
(((*(int64_t *)&(d)) & 0x7ff0000000000000LL) != 0x7ff0000000000000LL)
#define DNAN(d) ((d) != (d))
#define __unlikely(x) __builtin_expect(!!(x), 0)
#define __likely(x) __builtin_expect(!!(x), 1)
void DivideByZeroError(void) __attribute__((__noreturn__));
void lerrorf(value_t e, const char *format, ...)
@ -22,28 +44,3 @@ __attribute__((__noreturn__));
void bounds_error(const char *fname, value_t arr, value_t ind)
__attribute__((__noreturn__));
// branch prediction annotations
#ifdef __GNUC__
#define __unlikely(x) __builtin_expect(!!(x), 0)
#define __likely(x) __builtin_expect(!!(x), 1)
#else
#define __unlikely(x) (x)
#define __likely(x) (x)
#endif
#define DBL_MAXINT 9007199254740992LL
#define FLT_MAXINT 16777216
#define U64_MAX 18446744073709551615ULL
#define S64_MAX 9223372036854775807LL
#define S64_MIN (-S64_MAX - 1LL)
#define BIT63 0x8000000000000000LL
#define BIT31 0x80000000
#define LOG2_10 3.3219280948873626
#define sign_bit(r) ((*(int64_t *)&(r)) & BIT63)
#define LABS(n) (((n) ^ ((n) >> (NBITS - 1))) - ((n) >> (NBITS - 1)))
#define NBABS(n, nb) (((n) ^ ((n) >> ((nb)-1))) - ((n) >> ((nb)-1)))
#define DFINITE(d) \
(((*(int64_t *)&(d)) & 0x7ff0000000000000LL) != 0x7ff0000000000000LL)
#define DNAN(d) ((d) != (d))

View File

@ -1,11 +1,12 @@
#ifdef __WATCOMC__
typedef float float_t;
typedef double double_t;
#define __unlikely(x) (x)
#define __likely(x) (x)
#define __ORDER_BIG_ENDIAN__ 4321
#define __ORDER_LITTLE_ENDIAN__ 1234
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
#define BITS32
#endif
typedef float float_t;
typedef double double_t;
#pragma aux DivideByZeroError aborts;
extern void DivideByZeroError(void);