idk
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include "gyehoek.h"
|
||||
|
||||
SCM scm_newline () {
|
||||
putc ('\n', stdout);
|
||||
return SCM_PACK(NULL);
|
||||
}
|
||||
|
||||
SCM scm_write (SCM x) {
|
||||
if (SCM_IMP (x)) {
|
||||
printf ("#<immediate %ld>\n", SCM_UNPACK (x) >> 2);
|
||||
printf ("%ld", SCM_UNPACK (x) >> 2);
|
||||
} else {
|
||||
printf ("#<heap object 0x%016lx>\n", SCM_UNPACK (x));
|
||||
printf ("#<heap object 0x%016lx>", SCM_UNPACK (x));
|
||||
}
|
||||
return SCM_PACK(NULL);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,18 @@ typedef union SCM { struct { scm_t_bits n; } n; } SCM;
|
||||
#define SCM_TRUE 0b01100
|
||||
#define SCM_EOL 0b10100
|
||||
|
||||
#if (-1 >> 2 == -1) && (-4 >> 2 == -1) && (-5 >> 2 == -2) && (-8 >> 2 == -2)
|
||||
# define SCM_SRS(x, y) ((x) >> (y))
|
||||
#else
|
||||
# define SCM_SRS(x, y) \
|
||||
((x) < 0 \
|
||||
? -1 - (scm_t_signed_bits) (~(scm_t_bits)(x) >> (y)) \
|
||||
: ((x) >> (y)))
|
||||
#endif
|
||||
|
||||
#define SCM_MAKE_SMALL_INT(x) (SCM_SRS ((SCM_PACK (x)), 2) + 2)
|
||||
#define SCM_GET_SMALL_INT(x) (SCM_UNPACK (x) >> 2)
|
||||
|
||||
|
||||
|
||||
SCM scm_write (SCM);
|
||||
|
||||
Reference in New Issue
Block a user