The DC_* constants are bit values, but some code was using them as shift
offsets. This fixes the problem.
c = case_create (dict_get_proto (swi->dict->dict));
c = case_create (dict_get_proto (swi->dict->dict));
- dict_get_vars (swi->dict->dict, &vv, &nv,
- 1u << DC_ORDINARY | 1u << DC_SYSTEM);
+ dict_get_vars (swi->dict->dict, &vv, &nv, 0);
for (SV *sv = av_shift (av_case); SvOK (sv); sv = av_shift (av_case))
{
for (SV *sv = av_shift (av_case); SvOK (sv); sv = av_shift (av_case))
{
the last value. (Holes are created by deleting variables.)
All variables are compacted if EXCLUDE_CLASSES is 0, or it may
the last value. (Holes are created by deleting variables.)
All variables are compacted if EXCLUDE_CLASSES is 0, or it may
- contain one or more of (1u << DC_ORDINARY), (1u << DC_SYSTEM),
- or (1u << DC_SCRATCH) to cause the corresponding type of
- variable to be deleted during compaction. */
+ contain one or more of DC_ORDINARY, DC_SYSTEM, or DC_SCRATCH
+ to cause the corresponding type of variable to be deleted
+ during compaction. */
struct case_map *
case_map_to_compact_dict (const struct dictionary *d,
unsigned int exclude_classes)
struct case_map *
case_map_to_compact_dict (const struct dictionary *d,
unsigned int exclude_classes)
for (i = 0; i < n_vars; i++)
{
struct variable *v = dict_get_var (d, i);
for (i = 0; i < n_vars; i++)
{
struct variable *v = dict_get_var (d, i);
- if (!(exclude_classes & (1u << var_get_dict_class (v))))
+ if (!(exclude_classes & var_get_dict_class (v)))
insert_mapping (map, var_get_case_index (v), n_values++);
}
insert_mapping (map, var_get_case_index (v), n_values++);
}
if (!ds->discard_output)
{
struct dictionary *pd = ds->permanent_dict;
if (!ds->discard_output)
{
struct dictionary *pd = ds->permanent_dict;
- size_t compacted_n_values = dict_count_values (pd, 1u << DC_SCRATCH);
+ size_t compacted_n_values = dict_count_values (pd, DC_SCRATCH);
if (compacted_n_values < dict_get_next_value_idx (pd))
{
struct caseproto *compacted_proto;
if (compacted_n_values < dict_get_next_value_idx (pd))
{
struct caseproto *compacted_proto;
- compacted_proto = dict_get_compacted_proto (pd, 1u << DC_SCRATCH);
- ds->compactor = case_map_to_compact_dict (pd, 1u << DC_SCRATCH);
+ compacted_proto = dict_get_compacted_proto (pd, DC_SCRATCH);
+ ds->compactor = case_map_to_compact_dict (pd, DC_SCRATCH);
ds->sink = autopaging_writer_create (compacted_proto);
caseproto_unref (compacted_proto);
}
ds->sink = autopaging_writer_create (compacted_proto);
caseproto_unref (compacted_proto);
}
/* Returns the number of values occupied by the variables in
dictionary D. All variables are considered if EXCLUDE_CLASSES
/* Returns the number of values occupied by the variables in
dictionary D. All variables are considered if EXCLUDE_CLASSES
- is 0, or it may contain one or more of (1u << DC_ORDINARY),
- (1u << DC_SYSTEM), or (1u << DC_SCRATCH) to exclude the
- corresponding type of variable.
+ is 0, or it may contain one or more of DC_ORDINARY, DC_SYSTEM,
+ or DC_SCRATCH to exclude the corresponding type of variable.
The return value may be less than the number of values in one
of dictionary D's cases (as returned by
The return value may be less than the number of values in one
of dictionary D's cases (as returned by
size_t
dict_count_values (const struct dictionary *d, unsigned int exclude_classes)
{
size_t
dict_count_values (const struct dictionary *d, unsigned int exclude_classes)
{
- assert ((exclude_classes & ~((1u << DC_ORDINARY)
- | (1u << DC_SYSTEM)
- | (1u << DC_SCRATCH))) == 0);
+ assert (!(exclude_classes & ~DC_ALL));
size_t n = 0;
for (size_t i = 0; i < d->n_vars; i++)
{
enum dict_class class = var_get_dict_class (d->vars[i].var);
size_t n = 0;
for (size_t i = 0; i < d->n_vars; i++)
{
enum dict_class class = var_get_dict_class (d->vars[i].var);
- if (!(exclude_classes & (1u << class)))
+ if (!(exclude_classes & class))
struct caseproto *proto;
size_t i;
struct caseproto *proto;
size_t i;
- assert ((exclude_classes & ~((1u << DC_ORDINARY)
- | (1u << DC_SYSTEM)
- | (1u << DC_SCRATCH))) == 0);
+ assert (!(exclude_classes & ~DC_ALL));
proto = caseproto_create ();
for (i = 0; i < d->n_vars; i++)
{
struct variable *v = d->vars[i].var;
proto = caseproto_create ();
for (i = 0; i < d->n_vars; i++)
{
struct variable *v = d->vars[i].var;
- if (!(exclude_classes & (1u << var_get_dict_class (v))))
+ if (!(exclude_classes & var_get_dict_class (v)))
proto = caseproto_add_width (proto, var_get_width (v));
}
return proto;
proto = caseproto_add_width (proto, var_get_width (v));
}
return proto;
failure. */
static bool
parse_var_idx_class (struct lexer *lexer, const struct var_set *vs,
failure. */
static bool
parse_var_idx_class (struct lexer *lexer, const struct var_set *vs,
- size_t *idx,
- enum dict_class *class)
+ size_t *idx, enum dict_class *class)
{
if (!parse_vs_variable_idx (lexer, vs, idx))
return false;
{
if (!parse_vs_variable_idx (lexer, vs, idx))
return false;