From acfea9573fd7a9b289e6d5abb58bc78ff73224d4 Mon Sep 17 00:00:00 2001 From: Vasco Pedro Date: Wed, 22 Jul 2015 01:11:44 +0100 Subject: [PATCH] new fd_update_domain{,_and_check} macros --- src/variables.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+), 0 deletions(-) diff --git a/src/variables.h b/src/variables.h index b10f531..2ca1d01 100644 --- a/src/variables.h +++ b/src/variables.h @@ -36,6 +36,24 @@ int _fd_var_intersect(fd_int variable1, fd_int variable2); int _fd_var_contains_val(fd_int variable, int value); void _fd_var_set_value(fd_int variable, int value); +#define fd_update_domain(op,var,value) \ + { \ + _fd_var_ ## op(var, value); \ + \ + _fd_revise_connected(var); \ + } + +#define fd_update_domain_and_check(op, val, var) \ + { \ + if (_fd_var_ ## op(val, var)) \ + { \ + if (fd_domain_empty(var)) \ + return FD_NOSOLUTION; \ + \ + _fd_revise_connected(this, var); \ + } \ + } + // SEARCH extern int (*fd__cmp_variables)(fd_int, fd_int); int fd__cmp_var_size(fd_int, fd_int); -- libgit2 0.21.2