~sircmpwn/hare-users

1

NaN boxing

George Rose <george@1w1g.com>
Details
Message ID
<18bf07b6b2f.110f766b81830871.6063466823224780232@1w1g.com>
DKIM signature
missing
Download raw message
Following https://github.com/Robert-van-Engelen/tinylisp (https://github.com/Robert-van-Engelen/tinylisp/blob/main/tinylisp.pdf)
How could I do NaN boxing in hare
example C code:

```
#define I unsigned
#define L double

/*** with NaN Boxing ***/
L box(I t,I i) { L x; *(uint64_t*)&x = (uint64_t)t<<48|i; return x; }
I ord(L x) { return *(uint64_t*)&x; }

```
Details
Message ID
<CX4C9WSMTDBT.36I6UAOJZLSZZ@taiga>
In-Reply-To
<18bf07b6b2f.110f766b81830871.6063466823224780232@1w1g.com> (view parent)
DKIM signature
missing
Download raw message
I'm not sure what NaN boxing is, but the same code rewritten to use
Hare-style casts et al should work the same way I think.
Reply to thread Export thread (mbox)