mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
fix hashing of bitarray (uninitialized value in HashArchive & random
values at end)
This commit is contained in:
parent
d0776bd726
commit
cb0d8295bf
@ -916,7 +916,7 @@ namespace ngcore
|
||||
|
||||
class NGCORE_API HashArchive : public Archive
|
||||
{
|
||||
size_t hash_value;
|
||||
size_t hash_value = 0;
|
||||
char* h;
|
||||
int offset = 0;
|
||||
public:
|
||||
|
@ -141,7 +141,20 @@ namespace ngcore
|
||||
archive & size;
|
||||
if(archive.Input())
|
||||
SetSize(size);
|
||||
archive.Do(data, size/CHAR_BIT+1);
|
||||
if(archive.GetVersion("netgen") < "v6.2.2009-20")
|
||||
archive.Do(data, size/CHAR_BIT+1);
|
||||
else
|
||||
{
|
||||
archive.NeedsVersion("netgen", "v6.2.2009-20");
|
||||
archive.Do(data, size/CHAR_BIT);
|
||||
for(size_t i = 0; i < size%CHAR_BIT; i++)
|
||||
{
|
||||
size_t index = CHAR_BIT * (size/CHAR_BIT) + i;
|
||||
bool b = Test(index);
|
||||
archive & b;
|
||||
b ? SetBit(index) : Clear(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user