idk
This commit is contained in:
@@ -39,6 +39,7 @@
|
|||||||
bdwgc
|
bdwgc
|
||||||
pkg-config
|
pkg-config
|
||||||
guile
|
guile
|
||||||
|
clang-tools # clangd
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
4
play/a.c
4
play/a.c
@@ -1,9 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <libguile/scm.h>
|
#include <libguile/scm.h>
|
||||||
|
|
||||||
#define BLAH (-1 >> 2 == -1) && (-4 >> 2 == -1) && (-5 >> 2 == -2) && (-8 >> 2 == -2)
|
#if (-1 >> 2 == -1) && (-4 >> 2 == -1) && (-5 >> 2 == -2) && (-8 >> 2 == -2)
|
||||||
|
|
||||||
#if BLAH
|
|
||||||
# define SCM_SRS(x, y) ((x) >> (y))
|
# define SCM_SRS(x, y) ((x) >> (y))
|
||||||
#else
|
#else
|
||||||
# define SCM_SRS(x, y) \
|
# define SCM_SRS(x, y) \
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
;;; -*- mode:scheme -*-
|
;;; -*- mode:scheme -*-
|
||||||
|
|
||||||
(let ((x0 (prim:cons 4 2))
|
(let ((x0 (prim:cons 4 2)) (x3 (prim:write x2)) (x2 (prim:* 3 x1)) (x1 (prim:cdr x0))) x3)
|
||||||
(x3 (prim:write x2))
|
|
||||||
(x2 (prim:* 3 x1))
|
|
||||||
(x1 (prim:cdr x0)))
|
|
||||||
x3)
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "gyehoek.h"
|
#include "gyehoek.h"
|
||||||
|
|
||||||
|
SCM scm_newline () {
|
||||||
|
putc ('\n', stdout);
|
||||||
|
return SCM_PACK(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
SCM scm_write (SCM x) {
|
SCM scm_write (SCM x) {
|
||||||
if (SCM_IMP (x)) {
|
if (SCM_IMP (x)) {
|
||||||
printf ("#<immediate %ld>\n", SCM_UNPACK (x) >> 2);
|
printf ("%ld", SCM_UNPACK (x) >> 2);
|
||||||
} else {
|
} else {
|
||||||
printf ("#<heap object 0x%016lx>\n", SCM_UNPACK (x));
|
printf ("#<heap object 0x%016lx>", SCM_UNPACK (x));
|
||||||
}
|
}
|
||||||
return SCM_PACK(NULL);
|
return SCM_PACK(NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,18 @@ typedef union SCM { struct { scm_t_bits n; } n; } SCM;
|
|||||||
#define SCM_TRUE 0b01100
|
#define SCM_TRUE 0b01100
|
||||||
#define SCM_EOL 0b10100
|
#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);
|
SCM scm_write (SCM);
|
||||||
|
|||||||
Reference in New Issue
Block a user