-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #756 from cazfi/srvup
- Loading branch information
Showing
9 changed files
with
280 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
freeciv/patches/backports/0008-Add-new-bitvector-utility-functions.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
From ef337f93a4c8d4147da296703ef466252a449137 Mon Sep 17 00:00:00 2001 | ||
From: Marko Lindqvist <[email protected]> | ||
Date: Tue, 26 Sep 2023 12:32:50 +0300 | ||
Subject: [PATCH 08/47] Add new bitvector utility functions | ||
|
||
- dbv_copy() | ||
- dbv_to_bv() | ||
- bv_to_dbv() | ||
|
||
See osdn #48731 | ||
|
||
Signed-off-by: Marko Lindqvist <[email protected]> | ||
--- | ||
utility/bitvector.c | 30 ++++++++++++++++++++++++++++++ | ||
utility/bitvector.h | 4 ++++ | ||
2 files changed, 34 insertions(+) | ||
|
||
diff --git a/utility/bitvector.c b/utility/bitvector.c | ||
index 2d1851b68b..65047bfda6 100644 | ||
--- a/utility/bitvector.c | ||
+++ b/utility/bitvector.c | ||
@@ -198,6 +198,36 @@ bool dbv_are_equal(const struct dbv *pdbv1, const struct dbv *pdbv2) | ||
_BV_BYTES(pdbv2->bits)); | ||
} | ||
|
||
+/***********************************************************************//** | ||
+ Copy dynamic bit vector content from another. | ||
+***************************************************************************/ | ||
+void dbv_copy(struct dbv *dest, const struct dbv *src) | ||
+{ | ||
+ if (dest->bits != src->bits) { | ||
+ dbv_resize(dest, src->bits); | ||
+ } | ||
+ | ||
+ memcpy(&dest->vec, &src->vec, _BV_BYTES(src->bits)); | ||
+} | ||
+ | ||
+/***********************************************************************//** | ||
+ Copy dynamic bit vector content to static bitvector. Static vector | ||
+ is assumed to be at least same size as the dynamic one. | ||
+***************************************************************************/ | ||
+void dbv_to_bv(unsigned char *dest, const struct dbv *src) | ||
+{ | ||
+ memcpy(dest, &(src->vec), _BV_BYTES(src->bits)); | ||
+} | ||
+ | ||
+/***********************************************************************//** | ||
+ Copy static bit vector content to dynamic bitvector. Static vector | ||
+ is assumed to be at least same size as the dynamic one. | ||
+***************************************************************************/ | ||
+void bv_to_dbv(struct dbv *dest, const unsigned char *src) | ||
+{ | ||
+ memcpy(&(dest->vec), dest, _BV_BYTES(dest->bits)); | ||
+} | ||
+ | ||
/***********************************************************************//** | ||
Debug a dynamic bitvector. | ||
***************************************************************************/ | ||
diff --git a/utility/bitvector.h b/utility/bitvector.h | ||
index cccde12a83..9ce4230853 100644 | ||
--- a/utility/bitvector.h | ||
+++ b/utility/bitvector.h | ||
@@ -50,6 +50,10 @@ void dbv_clr(struct dbv *pdbv, int bit); | ||
void dbv_clr_all(struct dbv *pdbv); | ||
|
||
bool dbv_are_equal(const struct dbv *pdbv1, const struct dbv *pdbv2); | ||
+void dbv_copy(struct dbv *dest, const struct dbv *src); | ||
+ | ||
+void dbv_to_bv(unsigned char *dest, const struct dbv *src); | ||
+void bv_to_dbv(struct dbv *dest, const unsigned char *src); | ||
|
||
void dbv_debug(struct dbv *pdbv); | ||
|
||
-- | ||
2.40.1 | ||
|
30 changes: 0 additions & 30 deletions
30
freeciv/patches/backports/0022-AI-Set-countdown-correctly-if-senate-blocks-war-comp.patch
This file was deleted.
Oops, something went wrong.
240 changes: 0 additions & 240 deletions
240
freeciv/patches/backports/0022-Lua-Fix-Unit-is_on_possible_city_tile.patch
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.