0c8ce2b0
Pedro Roque
missing files
|
1
2
3
4
|
/*
* cl_bitmap_src.h
*
* Created on: 14/02/2017
|
4d26a735
Pedro Roque
Increased recogni...
|
5
|
* Author: Pedro
|
0c8ce2b0
Pedro Roque
missing files
|
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
*/
#if CL_D_TYPE == CL_BITMAP
#ifndef __OPENCL_VERSION__
#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>
#include "../utils/cl_syntax.h"
#endif
#include "../domains.h"
#include "cl_aux_functions.h"
#include "cl_bitmaps.h"
#include "cl_variables.h"
#include "../config.h"
#include "cl_ttl.h"
#ifndef M1
#define M1 NOTHING
#endif
#ifndef M2
#define M2 NOTHING
#endif
#ifndef M3
#define M3 NOTHING
#endif
#ifndef M4
#define M4 NOTHING
#endif
#ifndef FUNC_NAME
# define CONCAT(name, suffix) name ## suffix
# define FUNC_NAME(name, suffix) CONCAT(name, suffix)
# define FUNC(name) FUNC_NAME(name, SUFFIX)
#endif
#if SUFFIX == _pg || SUFFIX == _gp || SUFFIX == _mg || SUFFIX == _n
/*
* Create a new domain with the received values
* d - new domain to create
* d_vals - vector with all the values allowed for the new variable. The values must be ordered by increasing order
* n_vals - number of domain values in values vector
* */
|
4d26a735
Pedro Roque
Increased recogni...
|
54
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_new_vals)(M1 cl_bitmap *d, M2 int *d_vals, int n_vals TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
55
56
57
58
59
60
61
62
|
int i;
#if CL_N_WORDS == 1
(*d) = 0;
#else
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 104)
|
4d26a735
Pedro Roque
Increased recogni...
|
63
|
(*d)[i] = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
}
#endif
for (i = 0; i < n_vals; i++) {
CHECK_TTL(ttl_ctr, 9)
#if CL_CHECK_ERRORS
if (d_vals[i] < 0 || d_vals[i] > CL_D_MAX) {
printf((__constant char *)"\n###error 2\n");
}
#endif
#if CL_N_WORDS == 1
(*d) |= CL_ONE_ << d_vals[i];
#else
(*d)[d_vals[i] >> CL_DIV] |= (CL_ONE_ << (d_vals[i] - ((d_vals[i] >> CL_DIV) << CL_DIV)));
#endif
}
}
#endif
#if SUFFIX == _m || SUFFIX == _n || SUFFIX == _g
/*
* Check if domain is empty
* empty - will be 1 if domain is empty or 0 if not
* d - domain to check if empty
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
91
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_is_empty)(bool *empty, M1 cl_bitmap *d TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
92
93
|
#if CL_N_WORDS == 1
*empty = ((*d) == 0);
|
4d26a735
Pedro Roque
Increased recogni...
|
94
|
CHECK_TTL(ttl_ctr, 207)
|
0c8ce2b0
Pedro Roque
missing files
|
95
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
96
|
*empty = 1;
|
0c8ce2b0
Pedro Roque
missing files
|
97
|
|
4d26a735
Pedro Roque
Increased recogni...
|
98
99
100
101
102
103
|
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 115)
if ((*d)[i] != 0) {
*empty = 0;
i = CL_N_WORDS;
|
0c8ce2b0
Pedro Roque
missing files
|
104
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
105
|
}
|
0c8ce2b0
Pedro Roque
missing files
|
106
107
108
109
110
111
112
113
114
115
|
#endif
}
#endif
#if SUFFIX == _g
/*
* calculate the minimum of the domain. (Assume domain is not empty)
* min - the minimum value will be placed here
* d - domain to calculate minimum value
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
116
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_calc_min_val)(int *min, M1 cl_bitmap *d TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
117
118
119
120
121
122
123
124
125
126
127
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
CHECK_TTL(ttl_ctr, 208)
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
128
129
130
131
|
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
132
133
134
135
136
137
138
139
140
|
}
#endif
if (empty) {
printf((__constant char *)"\n###error 3\n");
}
#endif
#if CL_WORD == 32
// vector for speeding up the finding of a domain minimum 32 bits. De Bruijn sequence https://en.wikipedia.org/wiki/De_Bruijn_sequence
|
4d26a735
Pedro Roque
Increased recogni...
|
141
|
unsigned short mult_bit_pos_32[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 };
|
0c8ce2b0
Pedro Roque
missing files
|
142
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
143
|
// vector for speeding up the finding of a domain minimum 64 bits. De Bruijn sequence http://commsys.ijs.si/~matjaz/maxclique/MaxCliquePara/source_MaxCliquePara_v2.2/BitSet.h
|
0c8ce2b0
Pedro Roque
missing files
|
144
|
unsigned short mult_bit_pos_64[64] = { 0, 1, 2, 56, 3, 32, 57, 46, 29, 4, 20, 33, 7, 58, 11, 47, 62, 30, 18, 5, 16, 21, 34, 23, 53, 8, 59, 36, 25, 12, 48, 39, 63, 55, 31,
|
4d26a735
Pedro Roque
Increased recogni...
|
145
|
45, 28, 19, 6, 10, 61, 17, 15, 22, 52, 35, 24, 38, 54, 44, 27, 9, 60, 14, 51, 37, 43, 26, 13, 50, 42, 49, 41, 40 };
|
0c8ce2b0
Pedro Roque
missing files
|
146
147
148
|
#endif
#if CL_N_WORDS == 1 && CL_WORD == 32
|
4d26a735
Pedro Roque
Increased recogni...
|
149
|
CHECK_TTL(ttl_ctr, 209)
|
0c8ce2b0
Pedro Roque
missing files
|
150
|
|
4d26a735
Pedro Roque
Increased recogni...
|
151
|
*min = mult_bit_pos_32[(CL_WORD_TYPE) (((*d) & -(*d)) * 0x077CB531U) >> 27];
|
0c8ce2b0
Pedro Roque
missing files
|
152
153
154
155
156
157
158
159
160
161
|
#elif CL_N_WORDS == 1 && CL_WORD == 64
CHECK_TTL(ttl_ctr, 210)
*min = mult_bit_pos_64[(CL_WORD_TYPE) (((*d) & -(*d)) * 0x26752B916FC7B0DUL) >> 58];
#else
*min = 0;
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 105)
|
4d26a735
Pedro Roque
Increased recogni...
|
162
|
if ((*d)[i] != 0) {
|
0c8ce2b0
Pedro Roque
missing files
|
163
|
#if CL_WORD == 32
|
4d26a735
Pedro Roque
Increased recogni...
|
164
|
*min = mult_bit_pos_32[(CL_WORD_TYPE) (((*d)[i] & -((*d)[i])) * 0x077CB531U) >> 27] + (i << CL_DIV);
|
0c8ce2b0
Pedro Roque
missing files
|
165
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
166
|
*min = mult_bit_pos_64[(CL_WORD_TYPE) (((*d)[i] & -((*d)[i])) * 0x26752B916FC7B0DUL) >> 58] + (i << CL_DIV);
|
0c8ce2b0
Pedro Roque
missing files
|
167
|
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
168
169
|
i = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
170
171
172
173
174
175
176
177
178
179
180
|
}
#endif
}
#endif
#if SUFFIX == _m || SUFFIX == _pm || SUFFIX == _mp || SUFFIX == _n
/*
* calculate the minimum of the variable domain. (Assume variable is not empty)
* v - variable to calculate minimum value
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
181
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_calc_min_val)(M1 cl_var_p_bitmap *v TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
182
183
184
185
186
187
188
189
190
191
192
|
#if CL_CHECK_ERRORS
bool empty;
FUNC(cl_d_is_empty)(&empty, &v->prop_d TTL_CTR_V);
if (empty) {
printf((__constant char *)"\n###error 4\n");
}
#endif
#if CL_WORD == 32
// vector for speeding up the finding of a domain minimum 32 bits. De Bruijn sequence https://en.wikipedia.org/wiki/De_Bruijn_sequence
|
4d26a735
Pedro Roque
Increased recogni...
|
193
|
unsigned short mult_bit_pos_32[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 };
|
0c8ce2b0
Pedro Roque
missing files
|
194
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
195
|
// vector for speeding up the finding of a domain minimum 64 bits. De Bruijn sequence http://commsys.ijs.si/~matjaz/maxclique/MaxCliquePara/source_MaxCliquePara_v2.2/BitSet.h
|
0c8ce2b0
Pedro Roque
missing files
|
196
|
unsigned short mult_bit_pos_64[64] = { 0, 1, 2, 56, 3, 32, 57, 46, 29, 4, 20, 33, 7, 58, 11, 47, 62, 30, 18, 5, 16, 21, 34, 23, 53, 8, 59, 36, 25, 12, 48, 39, 63, 55, 31,
|
4d26a735
Pedro Roque
Increased recogni...
|
197
|
45, 28, 19, 6, 10, 61, 17, 15, 22, 52, 35, 24, 38, 54, 44, 27, 9, 60, 14, 51, 37, 43, 26, 13, 50, 42, 49, 41, 40 };
|
0c8ce2b0
Pedro Roque
missing files
|
198
199
200
|
#endif
#if CL_N_WORDS == 1 && CL_WORD == 32
|
4d26a735
Pedro Roque
Increased recogni...
|
201
|
CHECK_TTL(ttl_ctr, 211)
|
0c8ce2b0
Pedro Roque
missing files
|
202
|
|
4d26a735
Pedro Roque
Increased recogni...
|
203
|
v->min = mult_bit_pos_32[(CL_WORD_TYPE) ((v->prop_d & -(v->prop_d)) * 0x077CB531U) >> 27];
|
0c8ce2b0
Pedro Roque
missing files
|
204
205
206
207
208
209
210
211
212
213
214
|
#elif CL_N_WORDS == 1 && CL_WORD == 64
CHECK_TTL(ttl_ctr, 212)
v->min = mult_bit_pos_64[(CL_WORD_TYPE) ((v->prop_d & -(v->prop_d)) * 0x26752B916FC7B0DUL) >> 58];
#else
v->min = 0;
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 106)
|
4d26a735
Pedro Roque
Increased recogni...
|
215
|
if (v->prop_d[i] != 0) {
|
0c8ce2b0
Pedro Roque
missing files
|
216
|
#if CL_WORD == 32
|
4d26a735
Pedro Roque
Increased recogni...
|
217
|
v->min = mult_bit_pos_32[(CL_WORD_TYPE) ((v->prop_d[i] & -(v->prop_d[i])) * 0x077CB531U) >> 27] + (i << CL_DIV);
|
0c8ce2b0
Pedro Roque
missing files
|
218
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
219
|
v->min = convert_ushort(mult_bit_pos_64[(CL_WORD_TYPE) ((v->prop_d[i] & -(v->prop_d[i])) * 0x26752B916FC7B0DUL) >> 58] + (i << CL_DIV));
|
0c8ce2b0
Pedro Roque
missing files
|
220
|
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
221
222
|
i = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
223
224
225
226
227
228
229
230
231
232
233
234
|
}
#endif
}
#endif
#if SUFFIX == _n
/*
* calculate the maximum of the domain. (Assume domain is not empty)
* max - the maximum value will be placed here
* d - domain to calculate maximum value
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
235
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_calc_max_val)(int *max, M1 cl_bitmap *d TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
236
237
238
239
240
241
242
243
244
245
246
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
CHECK_TTL(ttl_ctr, 213)
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
247
248
249
250
|
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
251
252
253
254
255
256
257
258
259
|
}
#endif
if (empty) {
printf((__constant char *)"\n###error 5\n");
}
#endif
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
260
261
|
CHECK_TTL(ttl_ctr, 229)
*max = convert_int ((CL_WORD - clz((*d)) - 1));
|
0c8ce2b0
Pedro Roque
missing files
|
262
263
264
265
266
267
268
|
#else
*max = 0;
int i;
for (i = CL_N_WORDS - 1; i >= 0; i--) {
CHECK_TTL(ttl_ctr, 107)
|
4d26a735
Pedro Roque
Increased recogni...
|
269
270
271
272
|
if ((*d)[i] != 0) {
*max = convert_int(CL_WORD - 1 + (i << CL_DIV) - convert_int(clz((*d)[i])));
i = -1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
273
274
275
276
277
278
279
280
281
282
|
}
#endif
}
#endif
#if SUFFIX == _m || SUFFIX == _pm || SUFFIX == _mp || SUFFIX == _n
/*
* calculate the maximum value of the variable domain. (Assume variable is not empty)
* v - variable to calculate and return the maximum value
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
283
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_calc_max_val)(M1 cl_var_p_bitmap *v TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
284
285
286
287
288
289
290
291
292
293
294
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
CHECK_TTL(ttl_ctr, 214)
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
295
296
297
298
|
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
299
300
301
302
303
304
305
306
307
|
}
#endif
if (empty) {
printf((__constant char *)"\n###error 6\n");
}
#endif
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
308
309
310
311
312
313
314
|
CHECK_TTL(ttl_ctr, 230)
#if CL_USE_BOOLEAN_VS
if (v->boolean) {
if ((v->prop_d & 2) == 2) {
v->max = 1;
} else {
v->max = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
315
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
316
317
|
return;
}
|
0c8ce2b0
Pedro Roque
missing files
|
318
319
|
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
320
|
v->max = convert_ushort ((CL_WORD - clz(v->prop_d) - 1));
|
0c8ce2b0
Pedro Roque
missing files
|
321
322
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
323
|
#if CL_USE_BOOLEAN_VS
|
0c8ce2b0
Pedro Roque
missing files
|
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
if (v->boolean) {
if ((v->prop_d[0] & 2) == 2) {
v->max = 1;
} else {
v->max = 0;
}
return;
}
#endif
int i;
v->max = 0;
for (i = CL_N_WORDS - 1; i >= 0; i--) {
CHECK_TTL(ttl_ctr, 107)
|
4d26a735
Pedro Roque
Increased recogni...
|
339
340
341
342
|
if (v->prop_d[i] != 0) {
v->max = convert_ushort(CL_WORD - 1 + (i << CL_DIV) - convert_int(clz(v->prop_d[i])));
i = -1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
343
344
345
346
347
348
349
350
351
352
353
354
|
}
#endif
}
#endif
#if SUFFIX == _n || SUFFIX == _m
/*
* Count the number of values in the variable domain
* (uses popcount if OpenCL version is 1.2 or newer)
* d - domain to count values
* n_vals - where to place the calculated number of values
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
355
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_cnt_vals)(M1 cl_bitmap *d, int *n_vals TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
356
357
358
359
360
361
362
363
364
365
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
366
367
368
369
|
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
370
371
372
373
374
375
376
377
378
379
380
381
|
}
#endif
if (empty) {
printf((__constant char *)"\n###error 7\n");
}
#endif
#if CL_N_WORDS == 1
#if __OPENCL_VERSION__ > 110
(*n_vals) = convert_int(popcount((*d)));
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
382
383
|
unsigned short count;
CL_WORD_TYPE d_aux = (*d);
|
0c8ce2b0
Pedro Roque
missing files
|
384
|
|
4d26a735
Pedro Roque
Increased recogni...
|
385
386
387
388
389
|
for (count = 0; d_aux; count++) {
CHECK_TTL(ttl_ctr, 108)
d_aux &= d_aux - 1;
}
(*n_vals) = count;
|
0c8ce2b0
Pedro Roque
missing files
|
390
391
392
393
394
395
396
397
398
399
|
#endif
#else
#if __OPENCL_VERSION__ > 110
int i;
unsigned short count = 0;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 109)
|
4d26a735
Pedro Roque
Increased recogni...
|
400
|
count += convert_ushort(popcount((*d)[i]));
|
0c8ce2b0
Pedro Roque
missing files
|
401
402
403
404
405
406
407
408
409
410
411
|
}
(*n_vals) = count;
#else
int count = 0;
int count_aux;
CL_WORD_TYPE d_aux;
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 110)
|
4d26a735
Pedro Roque
Increased recogni...
|
412
|
d_aux = (*d)[i];
|
0c8ce2b0
Pedro Roque
missing files
|
413
414
|
for (count_aux = 0; d_aux; count_aux++) {
CHECK_TTL(ttl_ctr, 111)
|
4d26a735
Pedro Roque
Increased recogni...
|
415
|
d_aux &= d_aux - 1;
|
0c8ce2b0
Pedro Roque
missing files
|
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
|
}
count += count_aux;
}
(*n_vals) = count;
#endif
#endif
}
#endif
#if SUFFIX == _m || SUFFIX == _pm || SUFFIX == _mp || SUFFIX == _n
/*
* Count the number of values in the variable domain
* (uses popcount if OpenCL version is 1.2 or newer)
* v - variable to count values
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
432
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_cnt_vals)(M1 cl_var_p_bitmap *v TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
433
434
435
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
436
437
438
439
440
441
442
443
|
#if CL_USE_BOOLEAN_VS
if (v->boolean) {
if (v->prop_d == 3) {
v->n_vals = 2;
} else if (v->prop_d != 0) {
v->n_vals = 1;
} else {
v->n_vals = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
444
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
445
446
|
return;
}
|
0c8ce2b0
Pedro Roque
missing files
|
447
448
449
450
451
|
#endif
#if __OPENCL_VERSION__ > 110
v->n_vals = convert_ushort(popcount(v->prop_d));
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
452
453
|
int count;
CL_WORD_TYPE d_aux = v->prop_d;
|
0c8ce2b0
Pedro Roque
missing files
|
454
|
|
4d26a735
Pedro Roque
Increased recogni...
|
455
456
457
458
459
|
for (count = 0; d_aux; count++) {
CHECK_TTL(ttl_ctr, 108)
d_aux &= d_aux - 1;
}
v->n_vals = convert_ushort (count);
|
0c8ce2b0
Pedro Roque
missing files
|
460
461
462
463
|
#endif
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
464
|
#if CL_USE_BOOLEAN_VS
|
0c8ce2b0
Pedro Roque
missing files
|
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
if (v->boolean) {
if (v->prop_d[0] == 3) {
v->n_vals = 2;
} else if (v->prop_d[0] != 0) {
v->n_vals = 1;
} else {
v->n_vals = 0;
}
return;
}
#endif
#if __OPENCL_VERSION__ > 110
int i;
unsigned short count = 0;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 109)
|
4d26a735
Pedro Roque
Increased recogni...
|
483
|
count += convert_ushort(popcount(v->prop_d[i]));
|
0c8ce2b0
Pedro Roque
missing files
|
484
485
486
487
488
489
490
491
492
493
494
|
}
v->n_vals = count;
#else
int count = 0;
int count_aux;
CL_WORD_TYPE d_aux;
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 110)
|
4d26a735
Pedro Roque
Increased recogni...
|
495
|
d_aux = v->prop_d[i];
|
0c8ce2b0
Pedro Roque
missing files
|
496
497
|
for (count_aux = 0; d_aux; count_aux++) {
CHECK_TTL(ttl_ctr, 111)
|
4d26a735
Pedro Roque
Increased recogni...
|
498
|
d_aux &= d_aux - 1;
|
0c8ce2b0
Pedro Roque
missing files
|
499
500
501
502
503
504
505
506
507
508
|
}
count += count_aux;
}
v->n_vals = convert_ushort(count);
#endif
#endif
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
509
|
#if SUFFIX == _m3 || SUFFIX == _n || SUFFIX == _bd || SUFFIX == _vsg || SUFFIX == _m4 || SUFFIX == _m5
|
0c8ce2b0
Pedro Roque
missing files
|
510
511
512
513
514
515
516
|
/*
* Place the nth values of the domain in vals array. (Assume domain is not empty)
* d - domain to get nth value from
* first_nth - first nth value to get from the domain (from 1 to max value)
* last_nth - last nth value to get from the domain (from 1 to max value)
* vals - array where to save values
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
517
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_get_nth_vals)(M3 cl_bitmap *d, int first_nth, int last_nth, M4 int *vals TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
518
519
520
521
522
523
524
525
526
527
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
528
529
530
531
|
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
532
533
534
535
536
537
538
|
}
#endif
if (empty || first_nth < 1 || first_nth > CL_D_MAX + 1 || last_nth < 1 || last_nth > CL_D_MAX + 1) {
printf((__constant char *)"\n###error 10\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
539
540
541
|
int vals_ctr = 0;
int vals_idx = 0;
int i;
|
0c8ce2b0
Pedro Roque
missing files
|
542
543
544
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
545
546
|
for (i = 0; i <= CL_D_MAX; i++) {
CHECK_TTL(ttl_ctr, 10)
|
0c8ce2b0
Pedro Roque
missing files
|
547
|
|
4d26a735
Pedro Roque
Increased recogni...
|
548
549
|
if ((*d) & (CL_ONE_ << i)) {
vals_ctr++;
|
0c8ce2b0
Pedro Roque
missing files
|
550
|
|
4d26a735
Pedro Roque
Increased recogni...
|
551
552
|
if (vals_ctr >= first_nth) {
vals[vals_idx++] = i;
|
0c8ce2b0
Pedro Roque
missing files
|
553
|
|
4d26a735
Pedro Roque
Increased recogni...
|
554
555
|
if (vals_ctr == last_nth) {
i = CL_D_MAX + 1;
|
0c8ce2b0
Pedro Roque
missing files
|
556
557
558
|
}
}
}
|
4d26a735
Pedro Roque
Increased recogni...
|
559
|
}
|
0c8ce2b0
Pedro Roque
missing files
|
560
561
562
563
564
565
|
#else
int word_idx;
for (word_idx = 0; word_idx < CL_N_WORDS; word_idx++) {
CHECK_TTL(ttl_ctr, 113)
|
4d26a735
Pedro Roque
Increased recogni...
|
566
|
if ((*d)[word_idx] != 0) {
|
0c8ce2b0
Pedro Roque
missing files
|
567
|
|
4d26a735
Pedro Roque
Increased recogni...
|
568
569
|
for (i = 0; i < CL_WORD; i++) {
CHECK_TTL(ttl_ctr, 114)
|
0c8ce2b0
Pedro Roque
missing files
|
570
|
|
4d26a735
Pedro Roque
Increased recogni...
|
571
572
|
if ((*d)[word_idx] & (CL_ONE_ << i)) {
vals_ctr++;
|
0c8ce2b0
Pedro Roque
missing files
|
573
|
|
4d26a735
Pedro Roque
Increased recogni...
|
574
575
|
if (vals_ctr >= first_nth) {
vals[vals_idx++] = (word_idx << CL_DIV) + i;
|
0c8ce2b0
Pedro Roque
missing files
|
576
|
|
4d26a735
Pedro Roque
Increased recogni...
|
577
578
579
580
581
|
if (vals_ctr == last_nth) {
i = CL_WORD;
word_idx = CL_N_WORDS;
}
}
|
0c8ce2b0
Pedro Roque
missing files
|
582
583
584
|
}
}
}
|
0c8ce2b0
Pedro Roque
missing files
|
585
586
587
588
589
590
591
592
593
594
595
596
|
}
#endif
}
#endif
#if SUFFIX == _pm
/*
* Check if domains are equal
* equal - will be 1 if domains are equal or 0 if not
* d1 - domain 1
* d2 - domain 2
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
597
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_ds_equal)(bool *equal, M1 cl_bitmap *d1, M2 cl_bitmap *d2 TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
598
599
600
601
602
603
604
605
606
607
608
|
#if CL_CHECK_ERRORS
bool empty1, empty2;
#if CL_N_WORDS == 1
empty1 = ((*d1) == 0);
empty2 = ((*d2) == 0);
#else
empty1 = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
609
610
611
612
|
if ((*d1)[j] != 0) {
empty1 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
613
614
615
616
|
}
empty2 = 1;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
617
618
619
620
|
if ((*d2)[j] != 0) {
empty2 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
621
622
623
624
625
626
627
628
|
}
#endif
if (empty1 || empty2) {
printf((__constant char *)"\n###error 11\n");
}
#endif
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
629
630
|
*equal = 0;
CHECK_TTL(ttl_ctr, 215)
|
0c8ce2b0
Pedro Roque
missing files
|
631
|
|
4d26a735
Pedro Roque
Increased recogni...
|
632
633
634
|
if ((*d1) == (*d2)) {
*equal = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
635
636
637
638
639
640
|
#else
int i;
*equal = 1;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 116)
|
4d26a735
Pedro Roque
Increased recogni...
|
641
642
643
644
|
if ((*d1)[i] != (*d2)[i]) {
*equal = 0;
i = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
645
646
647
648
649
650
651
652
653
654
655
|
}
#endif
}
#endif
#if SUFFIX == _mg || SUFFIX == _g || SUFFIX == _gm || SUFFIX == _mbd || SUFFIX == _mvs
/*
* Copy d_src domain to d_dest domain
* d_dest - where to copy the values
* d_src - domain to copy
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
656
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_copy)(M1 cl_bitmap *d_dest, M2 cl_bitmap *d_src TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
657
658
659
660
661
662
663
664
665
666
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = ((*d_src) == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
667
668
669
670
|
if ((*d_src)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
671
672
673
674
675
676
677
678
|
}
#endif
if (empty) {
printf((__constant char *)"\n###error 12\n");
}
#endif
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
679
680
|
CHECK_TTL(ttl_ctr, 216)
(*d_dest) = (*d_src);
|
0c8ce2b0
Pedro Roque
missing files
|
681
682
683
684
|
#else
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 117)
|
4d26a735
Pedro Roque
Increased recogni...
|
685
|
(*d_dest)[i] = (*d_src)[i];
|
0c8ce2b0
Pedro Roque
missing files
|
686
687
688
689
690
691
692
693
694
695
696
|
}
#endif
}
#endif
#if SUFFIX == _pm || SUFFIX == _m
/*
* Copy v_src variable to v_dest variable (including to_prop and to_label)
* v_dest - where to copy the values
* v_src - variable to copy
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
697
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_copy)(M1 cl_var_p_bitmap *v_dest, M2 cl_var_p_bitmap *v_src TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
698
699
700
701
702
703
704
705
706
707
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v_src->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
708
709
710
711
|
if (v_src->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
712
713
714
715
716
717
718
|
}
#endif
if (empty || v_src->n_vals == 0 || v_src->n_vals > v_src->max + 1 || v_src->min > v_src->max || v_src->max > CL_D_MAX) {
printf((__constant char *)"\n###error 13\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
719
720
|
#if CL_USE_BOOLEAN_VS
v_dest->boolean = v_src->boolean;
|
0c8ce2b0
Pedro Roque
missing files
|
721
722
|
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
723
724
725
726
|
v_dest->max = v_src->max;
v_dest->min = v_src->min;
v_dest->n_vals = v_src->n_vals;
v_dest->to_prop = v_src->to_prop;
|
0c8ce2b0
Pedro Roque
missing files
|
727
728
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
729
730
|
CHECK_TTL(ttl_ctr, 217)
v_dest->prop_d = v_src->prop_d;
|
0c8ce2b0
Pedro Roque
missing files
|
731
732
733
734
735
|
#else
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 118)
|
4d26a735
Pedro Roque
Increased recogni...
|
736
|
v_dest->prop_d[i] = v_src->prop_d[i];
|
0c8ce2b0
Pedro Roque
missing files
|
737
738
739
740
741
742
743
744
745
746
747
748
749
|
}
#endif
}
#endif
#if SUFFIX == _m
/*
* Check if the variable contains the value
* contains - will be 1 if domain contains the value or 0 if not
* v - variable to check if contains value
* val - value to check if contained
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
750
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_contains_val)(bool *contains, M1 cl_var_p_bitmap *v, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
751
752
753
754
755
756
757
758
759
760
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
761
762
763
764
|
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
765
766
|
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
767
|
if (empty || v->n_vals == 0 || v->n_vals > v->max + 1 || v->min > v->max || v->max > CL_D_MAX) {
|
0c8ce2b0
Pedro Roque
missing files
|
768
|
printf((__constant char *)"\n###error 14\n");
|
4d26a735
Pedro Roque
Increased recogni...
|
769
|
printf((__constant char *)"\n### empty=%d v->n_vals=%u v->max=%u v->min=%u val=%d\n", empty, v->n_vals, v->max, v->min, val);
|
0c8ce2b0
Pedro Roque
missing files
|
770
771
772
|
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
773
774
775
776
777
|
if (val > v->max || val < v->min) {
*contains = 0;
return;
}
|
0c8ce2b0
Pedro Roque
missing files
|
778
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
779
780
|
CHECK_TTL(ttl_ctr, 218)
*contains = ((v->prop_d & (CL_ONE_ << val)) != 0);
|
0c8ce2b0
Pedro Roque
missing files
|
781
782
783
784
785
786
787
788
789
790
791
792
|
#else
CHECK_TTL(ttl_ctr, 219)
*contains = ((v->prop_d[val >> CL_DIV] & (CL_ONE_ << (val - ((val >> CL_DIV) << CL_DIV)))) != 0);
#endif
}
#endif
#if SUFFIX == _n || SUFFIX == _g
/*
* Set domain to empty
* d - domain to clear
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
793
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_clear)(M1 cl_bitmap *d TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
794
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
795
796
|
CHECK_TTL(ttl_ctr, 231)
(*d) = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
797
798
799
800
801
|
#else
CHECK_TTL(ttl_ctr, 220)
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 119)
|
4d26a735
Pedro Roque
Increased recogni...
|
802
|
(*d)[i] = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
803
804
805
806
807
808
809
810
811
812
|
}
#endif
}
#endif
#if SUFFIX == _m || SUFFIX == _n
/*
* set the variable as empty (n_vals == 0)
* v - variable to clear
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
813
814
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_clear)(M1 cl_var_p_bitmap *v) {
v->n_vals = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
815
816
817
818
819
820
821
822
823
824
|
}
#endif
#if SUFFIX == _mp || SUFFIX == _pm
/*
* Do operation d1 = d1 & d2
* changed - will be 1 if domain was changed or 0 if not
* d1 - domain to save operation
* d2 - domain to do AND with
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
825
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_intersect_d)(bool *changed, M1 cl_bitmap *d1, M2 cl_bitmap *d2 TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
826
827
828
829
830
831
832
833
834
835
836
|
#if CL_CHECK_ERRORS
bool empty1, empty2;
#if CL_N_WORDS == 1
empty1 = ((*d1) == 0);
empty2 = ((*d2) == 0);
#else
empty1 = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
837
838
839
840
|
if ((*d1)[j] != 0) {
empty1 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
841
842
843
844
|
}
empty2 = 1;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
845
846
847
848
|
if ((*d2)[j] != 0) {
empty2 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
849
850
851
852
853
854
855
|
}
#endif
if (empty1 || empty2) {
printf((__constant char *)"\n###error 15\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
856
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
857
858
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
859
860
|
CHECK_TTL(ttl_ctr, 221)
CL_WORD_TYPE d_prev = *d1;
|
0c8ce2b0
Pedro Roque
missing files
|
861
|
|
4d26a735
Pedro Roque
Increased recogni...
|
862
|
(*d1) &= (*d2);
|
0c8ce2b0
Pedro Roque
missing files
|
863
|
|
4d26a735
Pedro Roque
Increased recogni...
|
864
865
866
|
if ((*d1) != d_prev) {
*changed = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
867
868
869
870
871
872
|
#else
CL_WORD_TYPE d_prev;
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 120)
|
4d26a735
Pedro Roque
Increased recogni...
|
873
|
d_prev = (*d1)[i];
|
0c8ce2b0
Pedro Roque
missing files
|
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
|
(*d1)[i] &= (*d2)[i];
(*changed) |= (*d1)[i] != d_prev;
}
#endif
}
#endif
#if SUFFIX == _m || SUFFIX == _pm || SUFFIX == _mp
/*
* Do operation v1 = v1 & v2
* changed - will be 1 if domain was changed or 0 if not
* v1 - variable to save operation
* v2 - variable to do AND with
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
889
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_intersect_v)(bool *changed, M1 cl_var_p_bitmap *v1, M2 cl_var_p_bitmap *v2 TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
890
891
892
893
894
895
896
897
898
899
900
|
#if CL_CHECK_ERRORS
bool empty1, empty2;
#if CL_N_WORDS == 1
empty1 = (v1->prop_d == 0);
empty2 = (v2->prop_d == 0);
#else
empty1 = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
901
902
903
904
|
if (v1->prop_d[j] != 0) {
empty1 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
905
906
907
908
|
}
empty2 = 1;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
909
910
911
912
|
if (v2->prop_d[j] != 0) {
empty2 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
913
914
915
916
917
918
919
920
|
}
#endif
if (empty1 || v1->n_vals == 0 || v1->n_vals > v1->max + 1 || v1->min > v1->max || v1->max > CL_D_MAX
|| empty2 || v2->n_vals == 0 || v2->n_vals > v2->max + 1 || v2->min > v2->max || v2->max > CL_D_MAX) {
printf((__constant char *)"\n###error 16\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
921
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
922
923
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
924
|
CHECK_TTL(ttl_ctr, 222)
|
0c8ce2b0
Pedro Roque
missing files
|
925
|
|
4d26a735
Pedro Roque
Increased recogni...
|
926
|
CL_WORD_TYPE d_prev = v1->prop_d;
|
0c8ce2b0
Pedro Roque
missing files
|
927
|
|
4d26a735
Pedro Roque
Increased recogni...
|
928
|
v1->prop_d &= v2->prop_d;
|
0c8ce2b0
Pedro Roque
missing files
|
929
|
|
4d26a735
Pedro Roque
Increased recogni...
|
930
931
932
933
934
935
936
|
if (v1->prop_d != d_prev) {
if (v1->prop_d != 0) {
FUNC(cl_v_cnt_vals)(v1 TTL_CTR_V);
FUNC(cl_v_calc_min_val)(v1 TTL_CTR_V);
FUNC(cl_v_calc_max_val)(v1 TTL_CTR_V);
} else {
v1->n_vals = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
937
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
938
939
|
*changed = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
940
941
942
943
944
945
|
#else
CL_WORD_TYPE d_prev;
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 120)
|
4d26a735
Pedro Roque
Increased recogni...
|
946
|
d_prev = v1->prop_d[i];
|
0c8ce2b0
Pedro Roque
missing files
|
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
|
v1->prop_d[i] &= v2->prop_d[i];
(*changed) |= v1->prop_d[i] != d_prev;
}
if (*changed) {
FUNC(cl_v_cnt_vals)(v1 TTL_CTR_V);
if (v1->n_vals != 0) {
FUNC(cl_v_calc_min_val)(v1 TTL_CTR_V);
FUNC(cl_v_calc_max_val)(v1 TTL_CTR_V);
}
}
#endif
}
#endif
#if SUFFIX == _pm
/*
* Do operation d1 = d1 | d2
* changed - will be 1 if domain was changed or 0 if not
* d1 - domain to save operation
* d2 - domain to do OR with
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
969
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_union_d)(bool *changed, M1 cl_bitmap *d1, M2 cl_bitmap *d2 TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
970
971
972
973
974
975
976
977
978
979
980
|
#if CL_CHECK_ERRORS
bool empty1, empty2;
#if CL_N_WORDS == 1
empty1 = ((*d1) == 0);
empty2 = ((*d2) == 0);
#else
empty1 = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
981
982
983
984
|
if ((*d1)[j] != 0) {
empty1 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
985
986
987
988
|
}
empty2 = 1;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
989
990
991
992
|
if ((*d2)[j] != 0) {
empty2 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
993
994
995
996
997
998
999
|
}
#endif
if (empty1 || empty2) {
printf((__constant char *)"\n###error 17\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1000
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1001
1002
1003
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1004
1005
|
CHECK_TTL(ttl_ctr, 223)
CL_WORD_TYPE d_prev = *d1;
|
0c8ce2b0
Pedro Roque
missing files
|
1006
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1007
|
(*d1) |= (*d2);
|
0c8ce2b0
Pedro Roque
missing files
|
1008
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1009
1010
1011
|
if ((*d1) != d_prev) {
*changed = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1012
1013
1014
1015
1016
1017
|
#else
CL_WORD_TYPE d_prev;
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 120)
|
4d26a735
Pedro Roque
Increased recogni...
|
1018
|
d_prev = (*d1)[i];
|
0c8ce2b0
Pedro Roque
missing files
|
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
|
(*d1)[i] |= (*d2)[i];
(*changed) |= (*d1)[i] != d_prev;
}
#endif
}
#endif
#if SUFFIX == _pm
/*
* Do operation v1 = v1 | v2
* changed - will be 1 if domain was changed or 0 if not
* v1 - variable to save operation
* v2 - variable to do or with
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1034
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_union_v)(bool *changed, M1 cl_var_p_bitmap *v1, M2 cl_var_p_bitmap *v2 TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
|
#if CL_CHECK_ERRORS
bool empty1, empty2;
#if CL_N_WORDS == 1
empty1 = (v1->prop_d == 0);
empty2 = (v2->prop_d == 0);
#else
empty1 = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1046
1047
1048
1049
|
if (v1->prop_d[j] != 0) {
empty1 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1050
1051
1052
1053
|
}
empty2 = 1;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1054
1055
1056
1057
|
if (v2->prop_d[j] != 0) {
empty2 = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1058
1059
1060
1061
1062
1063
1064
1065
|
}
#endif
if (empty1 || v1->n_vals == 0 || v1->n_vals > v1->max + 1 || v1->min > v1->max || v1->max > CL_D_MAX
|| empty2 || v2->n_vals == 0 || v2->n_vals > v2->max + 1 || v2->min > v2->max || v2->max > CL_D_MAX) {
printf((__constant char *)"\n###error 18\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1066
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1067
1068
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1069
|
CL_WORD_TYPE d_prev = v1->prop_d;
|
0c8ce2b0
Pedro Roque
missing files
|
1070
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1071
|
v1->prop_d |= v2->prop_d;
|
0c8ce2b0
Pedro Roque
missing files
|
1072
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1073
1074
1075
1076
1077
1078
|
if (v1->prop_d != d_prev) {
FUNC(cl_v_cnt_vals)(v1 TTL_CTR_V);
FUNC(cl_v_calc_min_val)(v1 TTL_CTR_V);
FUNC(cl_v_calc_max_val)(v1 TTL_CTR_V);
*changed = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1079
1080
1081
1082
1083
1084
|
#else
CL_WORD_TYPE d_prev;
int i;
for (i = 0; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 121)
|
4d26a735
Pedro Roque
Increased recogni...
|
1085
|
d_prev = v1->prop_d[i];
|
0c8ce2b0
Pedro Roque
missing files
|
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
|
v1->prop_d[i] |= v2->prop_d[i];
(*changed) |= v1->prop_d[i] != d_prev;
}
if (*changed) {
FUNC(cl_v_cnt_vals)(v1 TTL_CTR_V);
FUNC(cl_v_calc_min_val)(v1 TTL_CTR_V);
FUNC(cl_v_calc_max_val)(v1 TTL_CTR_V);
*changed = 1;
}
#endif
}
#endif
#if SUFFIX == _g
/*
* remove value from domain. Doesn't test if domain changes neither if it has the value
* d - domain to remove value from
* val - value to remove from domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1107
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_del_val_no_tests)(M1 cl_bitmap *d, int val) {
|
0c8ce2b0
Pedro Roque
missing files
|
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
|
#if CL_CHECK_ERRORS
bool contains;
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1119
1120
1121
1122
|
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
|
}
#endif
#if CL_N_WORDS == 1
contains = (((*d) & (CL_ONE_ << val)) != 0);
#else
contains = (((*d)[val >> CL_DIV] & (CL_ONE_ << (val - ((val >> CL_DIV) << CL_DIV)))) != 0);
#endif
if (!contains || empty || val < 0 || val > CL_D_MAX) {
printf((__constant char *)"\n###error 19\n");
}
#endif
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1137
|
(*d) &= ~(CL_ONE_ << val);
|
0c8ce2b0
Pedro Roque
missing files
|
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
|
#else
(*d)[val >> CL_DIV] &= ~(CL_ONE_ << (val - ((val >> CL_DIV) << CL_DIV)));
#endif
}
#endif
#if SUFFIX == _g
/*
* remove value from domain
* changed - will be 1 if domain was changed or 0 if not
* d - domain to remove value from
* val - value to remove from domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1151
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_del_val)(bool *changed, M1 cl_bitmap *d, int val) {
|
0c8ce2b0
Pedro Roque
missing files
|
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1162
1163
1164
1165
|
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1166
1167
1168
1169
1170
1171
1172
|
}
#endif
if (empty) {
printf((__constant char *)"\n###error 20\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1173
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1174
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1175
|
if (val >= 0 && val <= CL_D_MAX) {
|
0c8ce2b0
Pedro Roque
missing files
|
1176
1177
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1178
|
CL_WORD_TYPE d_prev = (*d);
|
0c8ce2b0
Pedro Roque
missing files
|
1179
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1180
|
(*d) &= ~(CL_ONE_ << val);
|
0c8ce2b0
Pedro Roque
missing files
|
1181
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1182
|
*changed = ((*d) != d_prev);
|
0c8ce2b0
Pedro Roque
missing files
|
1183
1184
1185
1186
1187
1188
1189
1190
|
#else
int word_idx = val >> CL_DIV;
CL_WORD_TYPE d_prev = ((*d)[word_idx]);
(*d)[word_idx] &= ~(CL_ONE_ << (val - ((val >> CL_DIV) << CL_DIV)));
*changed = ((*d)[word_idx] != d_prev);
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1191
|
}
|
0c8ce2b0
Pedro Roque
missing files
|
1192
1193
1194
1195
1196
1197
1198
1199
1200
|
}
#endif
#if SUFFIX == _m
/*
* remove value from reification (boolean) variable when it has always 2 values (0 and 1)
* v - reification variable with values 0 and 1 to remove value from
* val - value to remove from variable
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1201
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_bool_del_val)(M1 cl_var_p_bitmap *v, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1212
1213
1214
1215
|
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1216
1217
1218
1219
1220
1221
1222
1223
|
}
#endif
if (empty || v->n_vals != 2 || v->min != 0 || v->max != 1 || val < 0 || val > 1) {
printf((__constant char *)"\n###error 21\n");
}
#endif
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1224
|
CHECK_TTL(ttl_ctr, 224)
|
0c8ce2b0
Pedro Roque
missing files
|
1225
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1226
1227
1228
|
if (val == 0) {
v->prop_d = 2;
v->min = 1;
|
0c8ce2b0
Pedro Roque
missing files
|
1229
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1230
1231
1232
1233
1234
|
} else {
v->prop_d = 1;
v->max = 0;
}
v->n_vals = 1;
|
0c8ce2b0
Pedro Roque
missing files
|
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
|
#else
CHECK_TTL(ttl_ctr, 225)
if (val == 0) {
v->prop_d[0] = 2;
v->min = 1;
} else {
v->prop_d[0] = 1;
v->max = 0;
}
v->n_vals = 1;
#endif
}
#endif
#if SUFFIX == _m || SUFFIX == _n
/*
* remove value from variable
* changed - will be 1 if domain was changed or 0 if not
* v - variable to remove value from
* val - value to remove from variable
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1260
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_del_val)(bool *changed, M1 cl_var_p_bitmap *v, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1271
1272
1273
1274
|
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1275
1276
1277
1278
1279
1280
1281
|
}
#endif
if (empty || v->n_vals == 0 || v->n_vals > v->max + 1 || v->min > v->max || v->max > CL_D_MAX) {
printf((__constant char *)"\n###error 22\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1282
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1283
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1284
|
if (val >= v->min && val <= v->max) {
|
0c8ce2b0
Pedro Roque
missing files
|
1285
1286
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1287
|
CL_WORD_TYPE d_prev = v->prop_d;
|
0c8ce2b0
Pedro Roque
missing files
|
1288
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1289
|
v->prop_d &= ~(CL_ONE_ << val);
|
0c8ce2b0
Pedro Roque
missing files
|
1290
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1291
1292
1293
1294
1295
|
if (v->prop_d != d_prev) {
v->n_vals--;
if (v->n_vals != 0) {
if (val == v->min) {
FUNC(cl_v_calc_min_val)(v TTL_CTR_V);
|
0c8ce2b0
Pedro Roque
missing files
|
1296
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1297
1298
|
} else if (val == v->max) {
FUNC(cl_v_calc_max_val)(v TTL_CTR_V);
|
0c8ce2b0
Pedro Roque
missing files
|
1299
|
}
|
0c8ce2b0
Pedro Roque
missing files
|
1300
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
1301
1302
|
*changed = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1303
1304
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
1305
1306
1307
1308
|
#if CL_USE_BOOLEAN_VS
if (v->boolean) {
*changed = 1;
v->n_vals--;
|
0c8ce2b0
Pedro Roque
missing files
|
1309
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1310
1311
|
if (v->n_vals == 1) {
v->prop_d[0] &= ~(CL_ONE_ << val);
|
0c8ce2b0
Pedro Roque
missing files
|
1312
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1313
1314
1315
1316
1317
|
if (val == 0) {
v->min = 1;
} else {
v->max = 0;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1318
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
1319
|
return;
|
0c8ce2b0
Pedro Roque
missing files
|
1320
|
}
|
0c8ce2b0
Pedro Roque
missing files
|
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
|
#endif
int word_idx = val >> CL_DIV;
CL_WORD_TYPE d_prev = v->prop_d[word_idx];
v->prop_d[word_idx] &= ~(CL_ONE_ << (val - ((val >> CL_DIV) << CL_DIV)));
if (v->prop_d[word_idx] != d_prev) {
v->n_vals--;
if (v->n_vals != 0) {
if (v->min == val) {
FUNC(cl_v_calc_min_val)(v TTL_CTR_V);
} else if (v->max == val) {
FUNC(cl_v_calc_max_val)(v TTL_CTR_V);
}
}
*changed = 1;
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1341
|
}
|
0c8ce2b0
Pedro Roque
missing files
|
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
|
}
#endif
#if SUFFIX == _g
/*
* Remove from the domain all the values less than val
* changed - will be 1 if domain was changed or 0 if not
* d - domain to remove values from
* val - minimum value to keep at domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1352
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_del_lt)(bool *changed, M1 cl_bitmap *d, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1363
1364
1365
1366
|
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1367
1368
1369
1370
1371
1372
1373
|
}
#endif
if (empty || val < 0 || val > CL_D_MAX) {
printf((__constant char *)"\n###error 24\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1374
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1375
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1376
1377
1378
1379
|
if (val > CL_D_MAX) {
FUNC(cl_d_clear)(d TTL_CTR_V);
*changed = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1380
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1381
|
if (val > 0 && val <= CL_D_MAX) {
|
0c8ce2b0
Pedro Roque
missing files
|
1382
1383
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1384
|
CL_WORD_TYPE d_prev = (*d);
|
0c8ce2b0
Pedro Roque
missing files
|
1385
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1386
|
(*d) &= (CL_ALL_ONES << val);
|
0c8ce2b0
Pedro Roque
missing files
|
1387
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1388
|
*changed = ((*d) != d_prev);
|
0c8ce2b0
Pedro Roque
missing files
|
1389
1390
1391
1392
1393
1394
1395
|
#else
CL_WORD_TYPE w;
int limit = val >> CL_DIV;
int word_idx;
for (word_idx = 0; word_idx < limit; word_idx++) {
CHECK_TTL(ttl_ctr, 122)
|
4d26a735
Pedro Roque
Increased recogni...
|
1396
1397
1398
1399
|
if ((*d)[word_idx] != 0) {
(*d)[word_idx] = 0;
(*changed) = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1400
1401
1402
1403
1404
1405
1406
1407
|
}
w = (*d)[word_idx] & (CL_ALL_ONES << ((val - ((val >> CL_DIV) << CL_DIV)) & CL_REM));
if ((*changed) || w != (*d)[word_idx]) {
(*d)[word_idx] = w;
*changed = 1;
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1408
|
}
|
0c8ce2b0
Pedro Roque
missing files
|
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
|
}
#endif
#if SUFFIX == _m || SUFFIX == _n
/*
* Remove from the variable all the values less than val
* changed - will be 1 if domain was changed or 0 if not
* v - variable to remove values from
* val - minimum value to keep at domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1419
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_del_lt)(bool *changed, M1 cl_var_p_bitmap *v, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1430
1431
1432
1433
|
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1434
1435
|
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1436
1437
|
if (empty || v->n_vals == 0 || v->n_vals > v->max + 1 || v->min > v->max || v->max > CL_D_MAX) {
printf((__constant char *)"\n###error 83\n");
|
0c8ce2b0
Pedro Roque
missing files
|
1438
1439
1440
1441
|
printf((__constant char *)"\n### empty=%d v->n_vals=%u v->max=%u v->min=%u val=%d\n", empty, v->n_vals, v->max, v->min, val);
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1442
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1443
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1444
1445
1446
1447
1448
|
if (val > v->max) {
FUNC(cl_v_clear)(v);
*changed = 1;
return;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1449
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1450
|
if (val > v->min) {
|
0c8ce2b0
Pedro Roque
missing files
|
1451
1452
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1453
|
CL_WORD_TYPE d_prev = v->prop_d;
|
0c8ce2b0
Pedro Roque
missing files
|
1454
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1455
|
v->prop_d &= (CL_ALL_ONES << val);
|
0c8ce2b0
Pedro Roque
missing files
|
1456
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1457
1458
1459
|
if (v->prop_d != d_prev) {
FUNC(cl_v_cnt_vals)(v TTL_CTR_V);
FUNC(cl_v_calc_min_val)(v TTL_CTR_V);
|
0c8ce2b0
Pedro Roque
missing files
|
1460
|
*changed = 1;
|
0c8ce2b0
Pedro Roque
missing files
|
1461
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
|
#else
#if CL_USE_BOOLEAN_VS
if (v->boolean) {
v->prop_d[0] = 2;
v->min = 1;
v->n_vals--;
*changed = 1;
return;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1472
1473
1474
1475
1476
1477
1478
1479
1480
|
#endif
CL_WORD_TYPE w;
int limit = val >> CL_DIV;
int min_idx = v->min >> CL_DIV;
int word_idx;
for (word_idx = min_idx; word_idx < limit; word_idx++) {
CHECK_TTL(ttl_ctr, 123)
|
4d26a735
Pedro Roque
Increased recogni...
|
1481
1482
1483
1484
|
if (v->prop_d[word_idx] != 0) {
v->prop_d[word_idx] = 0;
(*changed) = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
|
}
#ifndef __OPENCL_VERSION__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
w = v->prop_d[word_idx] & (CL_ALL_ONES << ((val - ((val >> CL_DIV) << CL_DIV)) & CL_REM));
#ifndef __OPENCL_VERSION__
#pragma GCC diagnostic pop
#endif
if ((*changed) || w != v->prop_d[word_idx]) {
v->prop_d[word_idx] = w;
FUNC(cl_v_cnt_vals)(v TTL_CTR_V);
if (v->n_vals != 0) {
FUNC(cl_v_calc_min_val)(v TTL_CTR_V);
}
(*changed) = 1;
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
|
}
}
#endif
#if SUFFIX == _m
/*
* Remove from the variable all the values greater than val. Doesn't test if domain changes neither if it has values for deletion
* v - variable to remove values from
* val - maximum value to keep at domain
*/
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_del_lt_no_tests)(M1 cl_var_p_bitmap *v, int val TTL_CTR) {
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
}
#endif
if (empty || v->n_vals == 0 || v->n_vals > v->max + 1 || v->min > v->max || v->max > CL_D_MAX || val < 0) {
printf((__constant char *)"\n###error 25\n");
printf((__constant char *)"\n### empty=%d v->n_vals=%u v->max=%u v->min=%u val=%d\n", empty, v->n_vals, v->max, v->min, val);
|
0c8ce2b0
Pedro Roque
missing files
|
1537
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
|
#endif
#if CL_N_WORDS == 1
v->prop_d &= (CL_ALL_ONES << val);
FUNC(cl_v_cnt_vals)(v TTL_CTR_V);
FUNC(cl_v_calc_min_val)(v TTL_CTR_V);
#else
#if CL_USE_BOOLEAN_VS
if (v->boolean) {
v->prop_d[0] = 2;
v->min = 1;
v->n_vals--;
return;
}
#endif
CL_WORD_TYPE w;
int limit = val >> CL_DIV;
int min_idx = v->min >> CL_DIV;
int word_idx;
for (word_idx = min_idx; word_idx < limit; word_idx++) {
CHECK_TTL(ttl_ctr, 123)
if (v->prop_d[word_idx] != 0) {
v->prop_d[word_idx] = 0;
}
}
#ifndef __OPENCL_VERSION__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
w = v->prop_d[word_idx] & (CL_ALL_ONES << ((val - ((val >> CL_DIV) << CL_DIV)) & CL_REM));
#ifndef __OPENCL_VERSION__
#pragma GCC diagnostic pop
#endif
v->prop_d[word_idx] = w;
FUNC(cl_v_cnt_vals)(v TTL_CTR_V);
FUNC(cl_v_calc_min_val)(v TTL_CTR_V);
#endif
|
0c8ce2b0
Pedro Roque
missing files
|
1583
1584
1585
1586
1587
1588
1589
1590
1591
|
}
#endif
#if SUFFIX == _g
/*
* Remove from the domain all the values less or equal to val. Doesn't test if domain changes neither if it has values for deletion
* d - domain to remove values from
* val - minimum value to remove from domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1592
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_del_le_no_tests)(M1 cl_bitmap *d, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
|
#if CL_CHECK_ERRORS
bool contains;
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1604
1605
1606
1607
|
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
|
}
#endif
#if CL_N_WORDS == 1
contains = (((*d) & (CL_ONE_ << val)) != 0);
#else
contains = (((*d)[val >> CL_DIV] & (CL_ONE_ << (val - ((val >> CL_DIV) << CL_DIV)))) != 0);
#endif
if (!contains || empty || val < 0 || val > CL_D_MAX) {
printf((__constant char *)"\n###error 26\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1620
|
val++;
|
0c8ce2b0
Pedro Roque
missing files
|
1621
1622
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1623
1624
|
CHECK_TTL(ttl_ctr, 226)
(*d) &= (CL_ALL_ONES << val);
|
0c8ce2b0
Pedro Roque
missing files
|
1625
1626
1627
1628
1629
1630
|
#else
int limit = val >> CL_DIV;
int word_idx;
for (word_idx = 0; word_idx < limit; word_idx++) {
CHECK_TTL(ttl_ctr, 124)
|
4d26a735
Pedro Roque
Increased recogni...
|
1631
|
(*d)[word_idx] = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
|
}
(*d)[word_idx] = (*d)[word_idx] & (CL_ALL_ONES << ((val - ((val >> CL_DIV) << CL_DIV)) & CL_REM));
#endif
}
#endif
#if SUFFIX == _g
/*
* Remove from the domain all the values less or equal to val
* changed - will be 1 if domain was changed or 0 if not
* d - domain to remove values from
* val - minimum value to remove from domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1645
1646
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_del_le)(bool *changed, M1 cl_bitmap *d, int val TTL_CTR) {
FUNC(cl_d_del_lt)(changed, d, ++val TTL_CTR_V);
|
0c8ce2b0
Pedro Roque
missing files
|
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
|
}
#endif
#if SUFFIX == _m
/*
* Remove from the variable all the values less or equal to val
* changed - will be 1 if domain was changed or 0 if not
* v - variable to remove values from
* val - minimum value to remove from domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1657
1658
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_del_le)(bool *changed, M1 cl_var_p_bitmap *v, int val TTL_CTR) {
FUNC(cl_v_del_lt)(changed, v, ++val TTL_CTR_V);
|
0c8ce2b0
Pedro Roque
missing files
|
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
|
}
#endif
#if SUFFIX == _g
/*
* Remove from the domain all the values greater than val
* changed - will be 1 if domain was changed or 0 if not
* d - domain to remove values from
* val - maximum value to keep at domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1669
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_del_gt)(bool *changed, M1 cl_bitmap *d, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1680
1681
1682
1683
|
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1684
1685
1686
1687
1688
1689
1690
|
}
#endif
if (empty || val < 0 || val > CL_D_MAX) {
printf((__constant char *)"\n###error 27\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1691
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1692
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1693
1694
1695
1696
|
if (val < 0) {
FUNC(cl_d_clear)(d TTL_CTR_V);
*changed = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1697
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1698
|
if (val < CL_D_MAX && val >= 0) {
|
0c8ce2b0
Pedro Roque
missing files
|
1699
1700
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1701
1702
|
CL_WORD_TYPE d_prev = (*d);
(*d) &= (CL_ALL_ONES >> (CL_REM - val));
|
0c8ce2b0
Pedro Roque
missing files
|
1703
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1704
|
*changed = ((*d) != d_prev);
|
0c8ce2b0
Pedro Roque
missing files
|
1705
1706
1707
1708
1709
1710
1711
1712
1713
|
#else
CL_WORD_TYPE w;
int word_idx = val >> CL_DIV;
int i;
w = (*d)[word_idx] & ((CL_ALL_ONES >> (CL_REM - ((val - ((val >> CL_DIV) << CL_DIV)) & CL_REM))));
for (i = word_idx + 1; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 125)
|
4d26a735
Pedro Roque
Increased recogni...
|
1714
1715
1716
1717
|
if ((*d)[i] != 0) {
(*d)[i] = 0;
(*changed) = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1718
1719
1720
1721
1722
1723
1724
|
}
if ((*changed) || w != (*d)[word_idx]) {
(*d)[word_idx] = w;
*changed = 1;
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
|
}
}
#endif
#if SUFFIX == _g
/*
* Remove from the domain all the values greater than val
* d - domain to remove values from
* val - maximum value to keep at domain
*/
FUNC_PREFIX CUDA_FUNC void FUNC(cl_d_del_gt_no_tests)(M1 cl_bitmap *d, int val TTL_CTR) {
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = ((*d) == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
if ((*d)[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1750
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
|
#endif
if (empty || val < 0 || val > CL_D_MAX) {
printf((__constant char *)"\n###error 27\n");
}
#endif
#if CL_N_WORDS == 1
(*d) &= (CL_ALL_ONES >> (CL_REM - val));
#else
CL_WORD_TYPE w;
int word_idx = val >> CL_DIV;
int i;
w = (*d)[word_idx] & ((CL_ALL_ONES >> (CL_REM - ((val - ((val >> CL_DIV) << CL_DIV)) & CL_REM))));
for (i = word_idx + 1; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 125)
(*d)[i] = 0;
}
(*d)[word_idx] = w;
#endif
|
0c8ce2b0
Pedro Roque
missing files
|
1774
1775
1776
1777
1778
1779
1780
1781
1782
|
}
#endif
#if SUFFIX == _m
/*
* Remove from the variable all the values greater than val. Doesn't test if domain changes neither if it has values for deletion
* v - variable to remove values from
* val - maximum value to keep at domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1783
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_del_gt_no_tests)(M1 cl_var_p_bitmap *v, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
|
#if CL_CHECK_ERRORS
bool contains;
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1795
1796
1797
1798
|
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
|
}
#endif
FUNC(cl_v_contains_val)(&contains, v, val TTL_CTR_V);
if (!contains || empty || v->n_vals == 0 || v->n_vals > v->max + 1 || v->min > v->max || v->max > CL_D_MAX || val < 0 || val > CL_D_MAX) {
printf((__constant char *)"\n###error 28\n");
}
#endif
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1809
1810
1811
1812
1813
1814
1815
|
#if CL_USE_BOOLEAN_VS
if (v->boolean) {
v->prop_d = 1;
v->max = 0;
v->n_vals = 1;
return;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1816
1817
|
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1818
|
v->prop_d &= (CL_ALL_ONES >> (CL_WORD - 1 - val));
|
0c8ce2b0
Pedro Roque
missing files
|
1819
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1820
1821
|
FUNC(cl_v_cnt_vals)(v TTL_CTR_V);
FUNC(cl_v_calc_max_val)(v TTL_CTR_V);
|
0c8ce2b0
Pedro Roque
missing files
|
1822
1823
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
1824
|
#if CL_USE_BOOLEAN_VS
|
0c8ce2b0
Pedro Roque
missing files
|
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
|
if (v->boolean) {
v->prop_d[0] = 1;
v->max = 0;
v->n_vals--;
return;
}
#endif
int word_idx = val >> CL_DIV;
int max_idx = v->max >> CL_DIV;
int i;
v->prop_d[word_idx] = v->prop_d[word_idx] & ((CL_ALL_ONES >> (CL_REM - ((val - ((val >> CL_DIV) << CL_DIV)) & CL_REM))));
for (i = word_idx + 1; i <= max_idx; i++) {
CHECK_TTL(ttl_ctr, 126)
|
4d26a735
Pedro Roque
Increased recogni...
|
1841
|
v->prop_d[i] = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
|
}
FUNC(cl_v_cnt_vals)(v TTL_CTR_V);
FUNC(cl_v_calc_max_val)(v TTL_CTR_V);
#endif
}
#endif
#if SUFFIX == _m || SUFFIX == _n
/*
* Remove from the variable all the values greater than val
* changed - will be 1 if domain was changed or 0 if not
* v - variable to remove values from
* val - maximum value to keep at domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1857
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_del_gt)(bool *changed, M1 cl_var_p_bitmap *v, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1868
1869
1870
1871
|
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1872
1873
1874
1875
1876
1877
1878
|
}
#endif
if (empty || v->n_vals == 0 || v->n_vals > v->max + 1 || v->min > v->max || v->max > CL_D_MAX) {
printf((__constant char *)"\n###error 29\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1879
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1880
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1881
1882
1883
1884
1885
|
if (val < v->min) {
FUNC(cl_v_clear)(v);
*changed = 1;
return;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1886
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1887
|
if (val < v->max) {
|
0c8ce2b0
Pedro Roque
missing files
|
1888
1889
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1890
1891
|
CL_WORD_TYPE d_prev = v->prop_d;
v->prop_d &= (CL_ALL_ONES >> (CL_WORD - 1 - val));
|
0c8ce2b0
Pedro Roque
missing files
|
1892
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1893
1894
1895
1896
1897
|
if (v->prop_d != d_prev) {
FUNC(cl_v_cnt_vals)(v TTL_CTR_V);
FUNC(cl_v_calc_max_val)(v TTL_CTR_V);
*changed = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1898
1899
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
1900
1901
1902
1903
1904
1905
1906
1907
|
#if CL_USE_BOOLEAN_VS
if (v->boolean) {
v->prop_d[0] = 1;
v->max = 0;
v->n_vals--;
(*changed) = 1;
return;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
|
#endif
CL_WORD_TYPE w;
int word_idx = val >> CL_DIV;
int i;
w = v->prop_d[word_idx] & ((CL_ALL_ONES >> (CL_REM - ((val - ((val >> CL_DIV) << CL_DIV)) & CL_REM))));
for (i = word_idx + 1; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 127)
|
4d26a735
Pedro Roque
Increased recogni...
|
1918
1919
1920
1921
|
if (v->prop_d[i] != 0) {
v->prop_d[i] = 0;
(*changed) = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
|
}
if ((*changed) || w != v->prop_d[word_idx]) {
v->prop_d[word_idx] = w;
FUNC(cl_v_cnt_vals)(v TTL_CTR_V);
if (v->n_vals != 0) {
FUNC(cl_v_calc_max_val)(v TTL_CTR_V);
}
(*changed) = 1;
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1934
|
}
|
0c8ce2b0
Pedro Roque
missing files
|
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
|
}
#endif
#if SUFFIX == _m
/*
* Remove from the variable all the values lesser than val
* changed - will be 1 if domain was changed or 0 if not
* v - variable to remove values from
* val - maximum value to remove from the domain
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1945
1946
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_del_ge)(bool *changed, M1 cl_var_p_bitmap *v, int val TTL_CTR) {
FUNC(cl_v_del_gt)(changed, v, --val TTL_CTR_V);
|
0c8ce2b0
Pedro Roque
missing files
|
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
|
}
#endif
#if SUFFIX == _m || SUFFIX == _n
/*
* Clear all values from variable, except val if present
* changed - will be 1 if domain was changed or 0 if not
* v - variable to clear all values except val
* val - value to keep in variable if present
*/
|
4d26a735
Pedro Roque
Increased recogni...
|
1957
|
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_del_all_except_val)(bool *changed, M1 cl_var_p_bitmap *v, int val TTL_CTR) {
|
0c8ce2b0
Pedro Roque
missing files
|
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
|
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
|
4d26a735
Pedro Roque
Increased recogni...
|
1968
1969
1970
1971
|
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
|
0c8ce2b0
Pedro Roque
missing files
|
1972
1973
1974
1975
1976
1977
1978
|
}
#endif
if (empty || v->n_vals == 0 || v->n_vals > v->max + 1 || v->min > v->max || v->max > CL_D_MAX || val < 0 || val > CL_D_MAX) {
printf((__constant char *)"\n###error 30\n");
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
1979
|
*changed = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1980
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1981
1982
1983
|
if (val < v->min || val > v->max) {
FUNC(cl_v_clear)(v);
*changed = 1;
|
0c8ce2b0
Pedro Roque
missing files
|
1984
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1985
|
} else {
|
0c8ce2b0
Pedro Roque
missing files
|
1986
1987
|
#if CL_N_WORDS == 1
|
4d26a735
Pedro Roque
Increased recogni...
|
1988
1989
|
CHECK_TTL(ttl_ctr, 228)
CL_WORD_TYPE d_prev = v->prop_d;
|
0c8ce2b0
Pedro Roque
missing files
|
1990
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1991
|
v->prop_d &= (CL_WORD_TYPE) (CL_ONE_ << val);
|
0c8ce2b0
Pedro Roque
missing files
|
1992
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1993
1994
1995
|
if (v->prop_d != d_prev) {
if (v->prop_d == 0) {
v->n_vals = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
1996
|
|
4d26a735
Pedro Roque
Increased recogni...
|
1997
1998
1999
2000
|
} else {
v->n_vals = 1;
v->min = convert_ushort (val);
v->max = convert_ushort (val);
|
0c8ce2b0
Pedro Roque
missing files
|
2001
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
2002
2003
|
*changed = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
2004
2005
|
#else
|
4d26a735
Pedro Roque
Increased recogni...
|
2006
|
#if CL_USE_BOOLEAN_VS
|
0c8ce2b0
Pedro Roque
missing files
|
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|
if (v->boolean) {
if (v->n_vals == 2) {
v->prop_d[0] &= (CL_ONE_ << val);
v->max = convert_ushort(val);
v->min = convert_ushort(val);
v->n_vals = 1;
*changed = 1;
}
return;
}
#endif
int word_idx = val >> CL_DIV;
int min_idx = v->min >> CL_DIV;
CL_WORD_TYPE d_prev = v->prop_d[word_idx];
int i;
for (i = min_idx; i < word_idx; i++) {
CHECK_TTL(ttl_ctr, 128)
|
4d26a735
Pedro Roque
Increased recogni...
|
2025
2026
2027
2028
|
if (v->prop_d[i] != 0) {
v->prop_d[i] = 0;
(*changed) = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
2029
2030
2031
2032
2033
2034
|
}
v->prop_d[word_idx] = d_prev & (CL_ONE_ << (val - ((val >> CL_DIV) << CL_DIV)));
for (i = word_idx + 1; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 129)
|
4d26a735
Pedro Roque
Increased recogni...
|
2035
2036
2037
2038
|
if (v->prop_d[i] != 0) {
v->prop_d[i] = 0;
(*changed) = 1;
}
|
0c8ce2b0
Pedro Roque
missing files
|
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
|
}
if ((*changed) || v->prop_d[word_idx] != d_prev) {
if (v->prop_d[word_idx] == 0) {
v->n_vals = 0;
} else {
v->n_vals = 1;
v->min = convert_ushort(val);
v->max = convert_ushort(val);
}
(*changed) = 1;
}
#endif
|
4d26a735
Pedro Roque
Increased recogni...
|
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
|
}
}
#endif
#if SUFFIX == _m || SUFFIX == _n
/*
* Clear all values from variable, except val
* v - variable to clear all values except val
* val - value to keep in variable if present
*/
FUNC_PREFIX CUDA_FUNC void FUNC(cl_v_del_all_except_val_no_tests)(M1 cl_var_p_bitmap *v, int val TTL_CTR) {
#if CL_CHECK_ERRORS
bool empty;
#if CL_N_WORDS == 1
empty = (v->prop_d == 0);
#else
empty = 1;
int j;
for (j = 0; j < CL_N_WORDS; j++) {
CHECK_TTL(ttl_ctr, 115)
if (v->prop_d[j] != 0) {
empty = 0;
j = CL_N_WORDS;
}
}
#endif
if (empty || v->n_vals == 0 || v->n_vals > v->max + 1 || v->min > v->max || v->max > CL_D_MAX || val < 0 || val > CL_D_MAX) {
printf((__constant char *)"\n###error 30\n");
}
#endif
#if CL_N_WORDS == 1
v->prop_d &= (CL_WORD_TYPE) (CL_ONE_ << val);
v->n_vals = 1;
v->min = convert_ushort (val);
v->max = convert_ushort (val);
#else
#if CL_USE_BOOLEAN_VS
if (v->boolean) {
v->prop_d[0] &= (CL_ONE_ << val);
v->max = convert_ushort(val);
v->min = convert_ushort(val);
v->n_vals = 1;
return;
}
#endif
int word_idx = val >> CL_DIV;
int min_idx = v->min >> CL_DIV;
CL_WORD_TYPE d_prev = v->prop_d[word_idx];
int i;
for (i = min_idx; i < word_idx; i++) {
CHECK_TTL(ttl_ctr, 128)
v->prop_d[i] = 0;
|
0c8ce2b0
Pedro Roque
missing files
|
2113
|
}
|
4d26a735
Pedro Roque
Increased recogni...
|
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
|
v->prop_d[word_idx] = d_prev & (CL_ONE_ << (val - ((val >> CL_DIV) << CL_DIV)));
for (i = word_idx + 1; i < CL_N_WORDS; i++) {
CHECK_TTL(ttl_ctr, 129)
v->prop_d[i] = 0;
}
v->n_vals = 1;
v->min = convert_ushort(val);
v->max = convert_ushort(val);
#endif
|
0c8ce2b0
Pedro Roque
missing files
|
2127
2128
2129
2130
2131
2132
2133
2134
|
}
#endif
#undef FUNC
#undef FUNC_NAME
#undef CONCAT
#endif
|