Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
4937fb09
Commit
4937fb09
authored
Jun 02, 2016
by
Bruno Schmitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minimizing memory usage. The implementation was using twice as much memory as necessary.
parent
1d26d58a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
30 deletions
+30
-30
src/opt/fxch/FxchSCHashTable.c
+30
-30
No files found.
src/opt/fxch/FxchSCHashTable.c
View file @
4937fb09
...
...
@@ -96,7 +96,7 @@ Fxch_SCHashTable_t* Fxch_SCHashTableCreate( Fxch_Man_t* pFxchMan,
int
nEntries
)
{
Fxch_SCHashTable_t
*
pSCHashTable
=
ABC_CALLOC
(
Fxch_SCHashTable_t
,
1
);
int
nBits
=
Abc_Base2Log
(
nEntries
+
1
)
+
1
;
int
nBits
=
Abc_Base2Log
(
nEntries
+
1
);
pSCHashTable
->
pFxchMan
=
pFxchMan
;
...
...
@@ -221,10 +221,10 @@ static inline int Fxch_SCHashTableEntryCompare( Fxch_SCHashTable_t* pSCHashTable
int
Fxch_SCHashTableInsert
(
Fxch_SCHashTable_t
*
pSCHashTable
,
Vec_Wec_t
*
vCubes
,
unsigned
int
SubCubeID
,
unsigned
int
SubCubeID
,
unsigned
int
iSubCube
,
unsigned
int
iCube
,
unsigned
int
iLit0
,
unsigned
int
iCube
,
unsigned
int
iLit0
,
unsigned
int
iLit1
,
char
fUpdate
)
{
...
...
@@ -238,7 +238,7 @@ int Fxch_SCHashTableInsert( Fxch_SCHashTable_t* pSCHashTable,
fStart
=
1
;
MurmurHash3_x86_32
(
(
void
*
)
&
SubCubeID
,
sizeof
(
int
),
0x9747b28c
,
&
BinID
);
iNewEntry
=
(
unsigned
int
)(
Vec_IntEntry
(
pSCHashTable
->
vCubeLinks
,
iCube
)
)
+
iSubCube
;
pBin
=
Fxch_SCHashTableBin
(
pSCHashTable
,
BinID
);
pNewEntry
=
Fxch_SCHashTableEntry
(
pSCHashTable
,
iNewEntry
);
...
...
@@ -286,15 +286,15 @@ int Fxch_SCHashTableInsert( Fxch_SCHashTable_t* pSCHashTable,
else
Base
=
Fxch_DivCreate
(
pSCHashTable
->
pFxchMan
,
&
(
pNewEntry
->
SCData
),
&
(
pEntry
->
SCData
)
);
if
(
Base
<
0
)
if
(
Base
<
0
)
continue
;
iNewDiv
=
Fxch_DivAdd
(
pSCHashTable
->
pFxchMan
,
fUpdate
,
0
,
Base
);
if
(
pSCHashTable
->
pFxchMan
->
SMode
==
0
)
{
Vec_WecPush
(
pSCHashTable
->
pFxchMan
->
vDivCubePairs
,
iNewDiv
,
pEntry
->
SCData
.
iCube
);
Vec_WecPush
(
pSCHashTable
->
pFxchMan
->
vDivCubePairs
,
iNewDiv
,
pNewEntry
->
SCData
.
iCube
);
Vec_WecPush
(
pSCHashTable
->
pFxchMan
->
vDivCubePairs
,
iNewDiv
,
pEntry
->
SCData
.
iCube
);
Vec_WecPush
(
pSCHashTable
->
pFxchMan
->
vDivCubePairs
,
iNewDiv
,
pNewEntry
->
SCData
.
iCube
);
}
Pairs
++
;
...
...
@@ -309,10 +309,10 @@ int Fxch_SCHashTableInsert( Fxch_SCHashTable_t* pSCHashTable,
int
Fxch_SCHashTableRemove
(
Fxch_SCHashTable_t
*
pSCHashTable
,
Vec_Wec_t
*
vCubes
,
unsigned
int
SubCubeID
,
unsigned
int
SubCubeID
,
unsigned
int
iSubCube
,
unsigned
int
iCube
,
unsigned
int
iLit0
,
unsigned
int
iCube
,
unsigned
int
iLit0
,
unsigned
int
iLit1
,
char
fUpdate
)
{
...
...
@@ -325,11 +325,11 @@ int Fxch_SCHashTableRemove( Fxch_SCHashTable_t* pSCHashTable,
fStart
=
1
;
MurmurHash3_x86_32
(
(
void
*
)
&
SubCubeID
,
sizeof
(
int
),
0x9747b28c
,
&
BinID
);
iEntry
=
(
unsigned
int
)(
Vec_IntEntry
(
pSCHashTable
->
vCubeLinks
,
iCube
)
)
+
iSubCube
;
pBin
=
Fxch_SCHashTableBin
(
pSCHashTable
,
BinID
);
pEntry
=
Fxch_SCHashTableEntry
(
pSCHashTable
,
iEntry
);
assert
(
pEntry
->
Used
==
1
);
assert
(
pEntry
->
SCData
.
iCube
==
iCube
);
...
...
@@ -345,12 +345,12 @@ int Fxch_SCHashTableRemove( Fxch_SCHashTable_t* pSCHashTable,
for
(
iNextEntry
=
(
int
)
pEntry
->
iNext
;
iNextEntry
!=
(
int
)
iEntry
;
iNextEntry
=
pNextEntry
->
iNext
,
fStart
=
0
)
{
int
Base
,
int
Base
,
iDiv
;
pNextEntry
=
Fxch_SCHashTableBin
(
pSCHashTable
,
iNextEntry
);
if
(
!
Fxch_SCHashTableEntryCompare
(
pSCHashTable
,
vCubes
,
&
(
pEntry
->
SCData
),
&
(
pNextEntry
->
SCData
)
)
if
(
!
Fxch_SCHashTableEntryCompare
(
pSCHashTable
,
vCubes
,
&
(
pEntry
->
SCData
),
&
(
pNextEntry
->
SCData
)
)
||
pEntry
->
SCData
.
iLit0
==
0
||
pNextEntry
->
SCData
.
iLit0
==
0
)
continue
;
...
...
@@ -360,27 +360,27 @@ int Fxch_SCHashTableRemove( Fxch_SCHashTable_t* pSCHashTable,
else
Base
=
Fxch_DivCreate
(
pSCHashTable
->
pFxchMan
,
&
(
pEntry
->
SCData
),
&
(
pNextEntry
->
SCData
)
);
if
(
Base
<
0
)
if
(
Base
<
0
)
continue
;
iDiv
=
Fxch_DivRemove
(
pSCHashTable
->
pFxchMan
,
fUpdate
,
0
,
Base
);
if
(
pSCHashTable
->
pFxchMan
->
SMode
==
0
)
{
int
i
,
iCube0
,
iCube1
;
Vec_Int_t
*
vDivCubePairs
=
Vec_WecEntry
(
pSCHashTable
->
pFxchMan
->
vDivCubePairs
,
iDiv
);
Vec_IntForEachEntryDouble
(
vDivCubePairs
,
iCube0
,
iCube1
,
i
)
if
(
(
iCube0
==
(
int
)
pNextEntry
->
SCData
.
iCube
&&
iCube1
==
(
int
)
pEntry
->
SCData
.
iCube
)
||
(
iCube0
==
(
int
)
pEntry
->
SCData
.
iCube
&&
iCube1
==
(
int
)
pNextEntry
->
SCData
.
iCube
)
)
{
Vec_IntDrop
(
vDivCubePairs
,
i
+
1
);
Vec_IntDrop
(
vDivCubePairs
,
i
);
}
if
(
Vec_IntSize
(
vDivCubePairs
)
==
0
)
Vec_IntErase
(
vDivCubePairs
);
int
i
,
iCube0
,
iCube1
;
Vec_Int_t
*
vDivCubePairs
=
Vec_WecEntry
(
pSCHashTable
->
pFxchMan
->
vDivCubePairs
,
iDiv
);
Vec_IntForEachEntryDouble
(
vDivCubePairs
,
iCube0
,
iCube1
,
i
)
if
(
(
iCube0
==
(
int
)
pNextEntry
->
SCData
.
iCube
&&
iCube1
==
(
int
)
pEntry
->
SCData
.
iCube
)
||
(
iCube0
==
(
int
)
pEntry
->
SCData
.
iCube
&&
iCube1
==
(
int
)
pNextEntry
->
SCData
.
iCube
)
)
{
Vec_IntDrop
(
vDivCubePairs
,
i
+
1
);
Vec_IntDrop
(
vDivCubePairs
,
i
);
}
if
(
Vec_IntSize
(
vDivCubePairs
)
==
0
)
Vec_IntErase
(
vDivCubePairs
);
}
Pairs
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment