Commit acfea9573fd7a9b289e6d5abb58bc78ff73224d4

Authored by Vasco Pedro
1 parent 65f52800
Exists in master

new fd_update_domain{,_and_check} macros

Showing 1 changed file with 18 additions and 0 deletions   Show diff stats
src/variables.h
... ... @@ -36,6 +36,24 @@ int _fd_var_intersect(fd_int variable1, fd_int variable2);
36 36 int _fd_var_contains_val(fd_int variable, int value);
37 37 void _fd_var_set_value(fd_int variable, int value);
38 38  
  39 +#define fd_update_domain(op,var,value) \
  40 + { \
  41 + _fd_var_ ## op(var, value); \
  42 + \
  43 + _fd_revise_connected(var); \
  44 + }
  45 +
  46 +#define fd_update_domain_and_check(op, val, var) \
  47 + { \
  48 + if (_fd_var_ ## op(val, var)) \
  49 + { \
  50 + if (fd_domain_empty(var)) \
  51 + return FD_NOSOLUTION; \
  52 + \
  53 + _fd_revise_connected(this, var); \
  54 + } \
  55 + }
  56 +
39 57 // SEARCH
40 58 extern int (*fd__cmp_variables)(fd_int, fd_int);
41 59 int fd__cmp_var_size(fd_int, fd_int);
... ...