From 7b440439681dea63d5f441dbcb82202225a1119c Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 15 Nov 2020 12:23:10 +0100 Subject: [PATCH] bitset: fix the copy from lbitset to other types 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 | 8 ++++++++ lib/bitset/list.c | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b554d61e68..64cacdefb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-11-15 Akim Demaille + + 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. + 2020-11-15 Akim Demaille bitset: making debug traces more useful diff --git a/lib/bitset/list.c b/lib/bitset/list.c index c1f3d9b153..dc00fdc294 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.39.5