Created
March 12, 2014 21:22
-
-
Save ramntry/9516683 to your computer and use it in GitHub Desktop.
Autogenerated C for multiplication function in SLL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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