diff options
| author | Tom Harley | 2020-01-08 20:17:50 +0000 |
|---|---|---|
| committer | Tom Harley | 2020-01-08 23:47:14 +0000 |
| commit | 505d8a2d364b3012455068d433ccec73cac38a50 (patch) | |
| tree | ed7a4a58e0c02074c4fcf9ebc89954fef5c74330 /examples/nq/run_func.c | |
| parent | I should commit more (diff) | |
| download | sinter-505d8a2d364b3012455068d433ccec73cac38a50.tar.gz sinter-505d8a2d364b3012455068d433ccec73cac38a50.zip | |
Add option to enable/disable boxing
Only affects atomic types, not structs. Accepts three options:
- “-u always”: always boxes
- “-u never”: never boxes
- “-u smart”: inserts a comparison of sizes, and boxes only if the item is bigger than a pointer.
“smart” is smart in name only; I expected the comparison to be optimised away (since the sizes of the types are known at compile-time), but it seems to run significantly slower than the other options.
Steps to improve: - try making the comparison compile-time (or, if it already is, find out why it’s so slow);
Diffstat (limited to 'examples/nq/run_func.c')
| -rw-r--r-- | examples/nq/run_func.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/nq/run_func.c b/examples/nq/run_func.c index 7ee0652..1442ecb 100644 --- a/examples/nq/run_func.c +++ b/examples/nq/run_func.c @@ -32,7 +32,7 @@ typedef struct list { if (arity == n) cast_apply_f(n) void *run_func(void *f, void *v, void *as) { - int arity = *((int *) v); + int arity = (int) v; list *l = (list *) as; void repeat_n_32(*arg_); @@ -74,6 +74,6 @@ void *run_func(void *f, void *v, void *as) { } void *inter_assert(void *a, void *b) { - assert(*((int *) a)); + assert(a); return b; } |
