1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-30 07:03:02 +00:00

Replace cast with type pun.

This commit is contained in:
Calvin Rose
2018-11-18 14:17:50 -05:00
parent 69b6894f6b
commit 4c4eff9390
5 changed files with 43 additions and 2 deletions

View File

@@ -36,7 +36,8 @@ void *janet_nanbox_to_pointer(Janet x) {
#else
x.i64 = (x.i64 << 16) >> 16;
#endif
return (void *)x.i64;
return x.pointer;
}
Janet janet_nanbox_from_pointer(void *p, uint64_t tagmask) {

View File

@@ -342,6 +342,7 @@ union Janet {
uint64_t u64;
int64_t i64;
double real;
void *pointer;
};
#define janet_u64(x) ((x).u64)

View File

@@ -35,7 +35,7 @@ int janet_line_getter(JanetArgs args) {
static void simpleline(JanetBuffer *buffer) {
buffer->count = 0;
char c;
int c;
for (;;) {
c = fgetc(stdin);
if (feof(stdin) || c < 0) {