mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 06:00:33 +05:00
Merge branch 'fix_bitarray_hash' into 'master'
fix hashing of bitarray (uninitialized value in HashArchive & random See merge request jschoeberl/netgen!353
This commit is contained in:
commit
e72fb08405
@ -916,7 +916,7 @@ namespace ngcore
|
|||||||
|
|
||||||
class NGCORE_API HashArchive : public Archive
|
class NGCORE_API HashArchive : public Archive
|
||||||
{
|
{
|
||||||
size_t hash_value;
|
size_t hash_value = 0;
|
||||||
char* h;
|
char* h;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
public:
|
public:
|
||||||
|
@ -141,7 +141,20 @@ namespace ngcore
|
|||||||
archive & size;
|
archive & size;
|
||||||
if(archive.Input())
|
if(archive.Input())
|
||||||
SetSize(size);
|
SetSize(size);
|
||||||
|
if(archive.GetVersion("netgen") < "v6.2.2009-20")
|
||||||
archive.Do(data, size/CHAR_BIT+1);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user