Root/b2/relop.h

1/*
2 * relop.h - Relational operators
3 *
4 * Copyright 2012 by Werner Almesberger
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12
13#ifndef RELOP_H
14#define RELOP_H
15
16#include <stdio.h>
17
18
19enum relop_idx {
20    idx_lt = 0,
21    idx_le = 1,
22    idx_eq = 2,
23    idx_ge = 3,
24    idx_gt = 4,
25    idx_n = 5
26};
27
28enum relop {
29    rel_lt = 1 << idx_lt,
30    rel_le = 1 << idx_le,
31    rel_eq = 1 << idx_eq,
32    rel_ge = 1 << idx_ge,
33    rel_gt = 1 << idx_gt,
34};
35
36
37/*
38 * relop_unreachable checks whether, for all X: !(X opb A) -> !(X opa B)
39 */
40
41int relop_unreachable(enum relop opa, enum relop opb,
42    const void *a, const void *b,
43    int (*cmp)(const void *a, enum relop op, const void *b, const void *user),
44    const void *user);
45void dump_relop(FILE *file, enum relop op);
46
47#endif /* !RELOP_H */
48

Archive Download this file

Branches:
master



interactive