summaryrefslogtreecommitdiff
path: root/examples/nq/glue.c
diff options
context:
space:
mode:
authorTom Harley2020-01-08 20:17:50 +0000
committerTom Harley2020-01-08 23:47:14 +0000
commit505d8a2d364b3012455068d433ccec73cac38a50 (patch)
treeed7a4a58e0c02074c4fcf9ebc89954fef5c74330 /examples/nq/glue.c
parentI should commit more (diff)
downloadsinter-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/glue.c')
-rw-r--r--examples/nq/glue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/nq/glue.c b/examples/nq/glue.c
index 5d8c6f0..07dfae7 100644
--- a/examples/nq/glue.c
+++ b/examples/nq/glue.c
@@ -34,8 +34,8 @@ int main(int argc, char **argv) {
printf("usage: %s n\n", argv[0]);
} else {
- int n = atoi(argv[1]);
- int n_solns = *((int *) count_solns(&n));
+ uintptr_t n = atoi(argv[1]);
+ int n_solns = (int) count_solns((void *) n);
printf("%i solutions found\n", n_solns);
}