mirror of
https://github.com/Z3Prover/z3
synced 2026-02-19 15:04:42 +00:00
[WIP] Update code base to use std::span (#8269)
* Initial plan * Add std::span to bit_util.h with backward compatibility Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Add std::span to hash.h unsigned_ptr_hash function Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Add std::span to ref_vector.h append and constructor Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
054a83e925
commit
3d7fbf9430
5 changed files with 192 additions and 106 deletions
|
|
@ -20,6 +20,7 @@ Revision History:
|
|||
|
||||
#include<algorithm>
|
||||
#include<string_view>
|
||||
#include<span>
|
||||
#include "util/util.h"
|
||||
|
||||
#define mix(a,b,c) \
|
||||
|
|
@ -68,8 +69,13 @@ inline unsigned hash_u_u(unsigned a, unsigned b) {
|
|||
|
||||
unsigned string_hash(std::string_view str, unsigned init_value);
|
||||
|
||||
inline unsigned unsigned_ptr_hash(std::span<unsigned const> vec, unsigned init_value) {
|
||||
return string_hash(std::string_view(reinterpret_cast<char const*>(vec.data()), vec.size() * sizeof(unsigned)), init_value);
|
||||
}
|
||||
|
||||
// Backward compatibility overload
|
||||
inline unsigned unsigned_ptr_hash(unsigned const* vec, unsigned len, unsigned init_value) {
|
||||
return string_hash(std::string_view((char const*)(vec), len*4), init_value);
|
||||
return unsigned_ptr_hash(std::span<unsigned const>(vec, len), init_value);
|
||||
}
|
||||
|
||||
template<typename Composite, typename GetKindHashProc, typename GetChildHashProc>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue