mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
Reverse the n-ary logxor change. The behaviour is weird in a set
context, but consistent with logxor and scsh. Maybe it should get the benefit of the doubt.
This commit is contained in:
parent
42b54c05a9
commit
d95744e986
2 changed files with 3 additions and 15 deletions
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
* srfi-14.c (scm_char_set_intersection, scm_char_set_xor): remove
|
* srfi-14.c (scm_char_set_intersection, scm_char_set_xor): remove
|
||||||
the compulsory cs1 arguments: all args are optional in final spec.
|
the compulsory cs1 arguments: all args are optional in final spec.
|
||||||
(scm_char_set_xor): bug fix: characters should only be included if
|
|
||||||
they occur in exactly one argument, but were included if they
|
|
||||||
occured an odd number of times >= 3, e.g, in (char-set-xor a a a)
|
|
||||||
where a is (char-set #\a). fix it with a "mask" array.
|
|
||||||
|
|
||||||
* srfi-14.h: declarations updated.
|
* srfi-14.h: declarations updated.
|
||||||
|
|
||||||
|
|
|
@ -1153,12 +1153,9 @@ SCM_DEFINE (scm_char_set_xor, "char-set-xor", 0, 0, 1,
|
||||||
res = make_char_set (FUNC_NAME);
|
res = make_char_set (FUNC_NAME);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
long * p;
|
|
||||||
int argnum = 2;
|
int argnum = 2;
|
||||||
long mask[LONGS_PER_CHARSET];
|
long * p;
|
||||||
int k;
|
|
||||||
|
|
||||||
memset (mask, 0, sizeof mask);
|
|
||||||
res = scm_char_set_copy (SCM_CAR (rest));
|
res = scm_char_set_copy (SCM_CAR (rest));
|
||||||
p = (long *) SCM_SMOB_DATA (res);
|
p = (long *) SCM_SMOB_DATA (res);
|
||||||
rest = SCM_CDR (rest);
|
rest = SCM_CDR (rest);
|
||||||
|
@ -1167,6 +1164,7 @@ SCM_DEFINE (scm_char_set_xor, "char-set-xor", 0, 0, 1,
|
||||||
{
|
{
|
||||||
SCM cs = SCM_CAR (rest);
|
SCM cs = SCM_CAR (rest);
|
||||||
long *cs_data;
|
long *cs_data;
|
||||||
|
int k;
|
||||||
|
|
||||||
SCM_VALIDATE_SMOB (argnum, cs, charset);
|
SCM_VALIDATE_SMOB (argnum, cs, charset);
|
||||||
argnum++;
|
argnum++;
|
||||||
|
@ -1174,14 +1172,8 @@ SCM_DEFINE (scm_char_set_xor, "char-set-xor", 0, 0, 1,
|
||||||
rest = SCM_CDR (rest);
|
rest = SCM_CDR (rest);
|
||||||
|
|
||||||
for (k = 0; k < LONGS_PER_CHARSET; k++)
|
for (k = 0; k < LONGS_PER_CHARSET; k++)
|
||||||
{
|
p[k] ^= cs_data[k];
|
||||||
mask[k] |= p[k] & cs_data[k];
|
|
||||||
p[k] ^= cs_data[k];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* avoid including characters that occur an odd number of times >= 3. */
|
|
||||||
for (k = 0; k < LONGS_PER_CHARSET; k++)
|
|
||||||
p[k] &= ~mask[k];
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue