1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-16 18:51:53 +02:00
eda-tools/b2/relop.h
Werner Almesberger 9cafe23fb8 b2/: simplified and corrected logic behind relop_redundant
We now generate the operator map algorithmically, which is a bit less
classy than solving the logical equations, but easier to get right.

Also renamed the somewhat vague "redundant" to "unreachable".
2012-06-01 14:52:12 -03:00

48 lines
963 B
C

/*
* relop.h - Relational operators
*
* Copyright 2012 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef RELOP_H
#define RELOP_H
#include <stdio.h>
enum relop_idx {
idx_lt = 0,
idx_le = 1,
idx_eq = 2,
idx_ge = 3,
idx_gt = 4,
idx_n = 5
};
enum relop {
rel_lt = 1 << idx_lt,
rel_le = 1 << idx_le,
rel_eq = 1 << idx_eq,
rel_ge = 1 << idx_ge,
rel_gt = 1 << idx_gt,
};
/*
* relop_unreachable checks whether, for all X: !(X opb A) -> !(X opa B)
*/
int relop_unreachable(enum relop opa, enum relop opb,
const void *a, const void *b,
int (*cmp)(const void *a, enum relop op, const void *b, const void *user),
const void *user);
void dump_relop(FILE *file, enum relop op);
#endif /* !RELOP_H */