[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/5] bitset: fix the copy from lbitset to other types
From: |
Akim Demaille |
Subject: |
[PATCH 3/5] bitset: fix the copy from lbitset to other types |
Date: |
Sun, 15 Nov 2020 14:11:39 +0100 |
bitset_copy from an lbitset did not check whether the destination has
the same type. Apply the same strategy as elsewhere.
Without this commit, the following one fails.
* lib/bitset/list.c (lbitset_copy): Rename as...
(lbitset_copy_): this.
(lbitset_copy): New.
Dispatch to heterogeneous/homogeneous copy.
---
ChangeLog | 6 ++++++
lib/bitset/list.c | 11 ++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 3e3e78ed3..ff21b6631 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2020-11-15 Akim Demaille <akim@lrde.epita.fr>
+ bitset: fix the copy from lbitset to other types
+ * lib/bitset/list.c (lbitset_copy): Rename as...
+ (lbitset_copy_): this.
+ (lbitset_copy): New.
+ Dispatch to heterogeneous/homogeneous copy.
+
bitset: making debug traces more useful
* lib/bitset.c (bitset_print): Print the bitset type in verbose node.
diff --git a/lib/bitset/list.c b/lib/bitset/list.c
index c1f3d9b15..dc00fdc29 100644
--- a/lib/bitset/list.c
+++ b/lib/bitset/list.c
@@ -428,7 +428,7 @@ lbitset_equal_p (bitset dst, bitset src)
/* Copy bits from bitset SRC to bitset DST. */
static inline void
-lbitset_copy (bitset dst, bitset src)
+lbitset_copy_ (bitset dst, bitset src)
{
if (src == dst)
return;
@@ -463,6 +463,15 @@ lbitset_copy (bitset dst, bitset src)
}
+static void
+lbitset_copy (bitset dst, bitset src)
+{
+ if (BITSET_COMPATIBLE_ (dst, src))
+ lbitset_copy_ (dst, src);
+ else
+ bitset_copy_ (dst, src);
+}
+
/* Copy bits from bitset SRC to bitset DST. Return true if
bitsets different. */
static inline bool
--
2.29.2
- [PATCH 0/5] bitset: use ffs, Akim Demaille, 2020/11/15
- [PATCH 1/5] bitset: comment changes, Akim Demaille, 2020/11/15
- [PATCH 2/5] bitset: making debug traces more useful, Akim Demaille, 2020/11/15
- [PATCH 3/5] bitset: fix the copy from lbitset to other types,
Akim Demaille <=
- [PATCH 4/5] bitset: more tests, Akim Demaille, 2020/11/15
- [PATCH 5/5] bitset: use ffsl to accelerate iterations over set bits, Akim Demaille, 2020/11/15
- Re: [PATCH 5/5] bitset: use ffsl to accelerate iterations over set bits, Bruno Haible, 2020/11/15
- Re: [PATCH 5/5] bitset: use ffsl to accelerate iterations over set bits, Akim Demaille, 2020/11/15
- Re: [PATCH 5/5] bitset: use ffsl to accelerate iterations over set bits, Bruno Haible, 2020/11/15
- Re: [PATCH 5/5] bitset: use ffsl to accelerate iterations over set bits, Akim Demaille, 2020/11/15
- Re: [PATCH 5/5] bitset: use ffsl to accelerate iterations over set bits, Bruno Haible, 2020/11/17
- Re: [PATCH 5/5] bitset: use ffsl to accelerate iterations over set bits, Akim Demaille, 2020/11/18