Skip to content

Instantly share code, notes, and snippets.

@ramntry
Created March 12, 2014 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramntry/9516683 to your computer and use it in GitHub Desktop.
Save ramntry/9516683 to your computer and use it in GitHub Desktop.
Autogenerated C for multiplication function in SLL
Object mul_(Object ctr, Object y_) {
Object result = NULL;
switch (SLL_get_ctr_id(ctr[0])) {
case N_: {
Object const gcall_mul = mul_((Object)ctr[1], y_);
Object const gcall_neg = neg_(gcall_mul);
result = gcall_neg;
break;
} case S_: {
Object const gcall_mul_1 = mul_((Object)ctr[1], y_);
Object const gcall_add = add_(y_, gcall_mul_1);
result = gcall_add;
break;
} case Z_: {
Object const ctr_Z = create_object_0(Z_);
result = ctr_Z;
break;
} default:
sll_fatal_error("Inexhaustive pattern matching");
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment