Skip to content

Commit

Permalink
vm.c: cpplint
Browse files Browse the repository at this point in the history
  • Loading branch information
djwatson committed Oct 14, 2023
1 parent ecb7b70 commit ea88353
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 161 deletions.
10 changes: 9 additions & 1 deletion src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ typedef struct cons_s {
typedef struct closure_s {
uint32_t type;
uint32_t rc;
uint64_t len;
gc_obj len;
gc_obj v[];
} closure_s;

typedef closure_s cont_s;

typedef struct port_s {
uint32_t type;
uint32_t rc;
Expand Down Expand Up @@ -122,6 +124,9 @@ static inline symbol *to_symbol(gc_obj obj) {
static inline closure_s *to_closure(gc_obj obj) {
return (closure_s *)(obj - CLOSURE_TAG);
}
static inline cont_s *to_cont(gc_obj obj) {
return (cont_s *)(obj - PTR_TAG);
}
// This one is not PTR, but anything!
static inline void *to_raw_ptr(gc_obj obj) { return (void *)(obj & ~TAG_MASK); }
static inline string_s *to_string(gc_obj obj) {
Expand Down Expand Up @@ -188,6 +193,9 @@ static inline gc_obj tag_cons(cons_s *s) {
static inline gc_obj tag_vector(vector_s *s) {
return (gc_obj)((int64_t)s + VECTOR_TAG);
}
static inline gc_obj tag_cont(closure_s *s) {
return (gc_obj)((int64_t)s + PTR_TAG);
}
static inline gc_obj tag_closure(closure_s *s) {
return (gc_obj)((int64_t)s + CLOSURE_TAG);
}
Expand Down
Loading

0 comments on commit ea88353

Please sign in to comment.