aboutsummaryrefslogtreecommitdiffstats
path: root/libnormalform_make_binary__.c
blob: 11bc0e18866b7371aa96d1e97df12ebfe00c9c20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST


struct expression *
(libnormalform_make_binary__)(int invert_left, struct expression *left,
                              int invert_right, struct expression *right, enum libnormalform_term_type type)
{
	struct expression *ret;
	ret = malloc(sizeof(*ret));
	if (!ret)
		return NULL;
	*ret = EXPRESSION_INIT(type);
	ret->nterms = 2;
	ret->terms = malloc(2 * sizeof(*ret->terms));
	if (!ret->terms) {
		free(ret);
		return NULL;
	}
	(ret->terms[0] = left)->invert ^= (unsigned char)invert_left;
	(ret->terms[1] = right)->invert ^= (unsigned char)invert_right;
	return ret;
}


#else

TODO_TEST

#endif