summaryrefslogtreecommitdiff
path: root/apl9.h
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2022-02-09 17:25:28 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2022-02-09 17:25:28 +0000
commit60a9104f6b737976e30271ac1c1a432cd9a5c657 (patch)
treed1d0617cf189e04ff41d979d6adf13717c7c055a /apl9.h
parent36e45dfccb5e5321682c0ec24dead22cf40fcb16 (diff)
Encode ref count in bit mask too
Diffstat (limited to 'apl9.h')
-rw-r--r--apl9.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/apl9.h b/apl9.h
index 8135f39..1208cac 100644
--- a/apl9.h
+++ b/apl9.h
@@ -75,7 +75,7 @@ typedef struct Mail Mail;
struct Mixed
{
- int type;
+ u8int type;
union {
vlong i;
double f;
@@ -87,10 +87,12 @@ struct Mixed
#define GetRank(a) ((u8int)((a->info & 0x0000000F00000000) >> 32))
#define GetType(a) ((u8int)((a->info & 0x000000F000000000) >> 36))
#define GetStrand(a) ((u8int)((a->info & 0x0000010000000000) >> 40))
+#define GetRefs(a) ((u32int)((a->info & 0xFFFFFE0000000000) >> 41))
#define SetSize(a,v) (a->info ^= ((u64int)GetSize(a)^v))
#define SetRank(a,v) (a->info ^= ((u64int)(GetRank(a)^v) << 32))
#define SetType(a,v) (a->info ^= ((u64int)(GetType(a)^v) << 36))
#define SetStrand(a,v) (a->info ^= ((u64int)(GetStrand(a)^v) << 40))
+#define SetRefs(a,v) (a->info ^= ((u64int)(GetRefs(a)^v) << 41))
struct Array
{
@@ -109,10 +111,9 @@ struct Array
* 32-35: 4 bits for the rank (max rank 15)
* 36-39: 4 bits for the type (16 options)
* 40: 1 bit for stranding
- * 41-63: unused
+ * 41-63: 23 bits for reference counting (max refs = 8388608)
* NOTE: should only be modified through the macros defined above
*/
- ulong refs;
};
struct Statement