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
e72438b2
Commit
e72438b2
authored
Mar 18, 2020
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Downgrading random number generator to be not inlined.
parent
f8b1be8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
24 deletions
+37
-24
src/misc/util/abc_global.h
+2
-24
src/misc/util/utilSort.c
+35
-0
No files found.
src/misc/util/abc_global.h
View file @
e72438b2
...
...
@@ -480,30 +480,6 @@ static inline int Abc_PrimeCudd( unsigned int p )
}
// end of Cudd_Prime
// Creates a sequence of random numbers.
// http://www.codeproject.com/KB/recipes/SimpleRNG.aspx
#define NUMBER1 3716960521u
#define NUMBER2 2174103536u
static
inline
unsigned
Abc_Random
(
int
fReset
)
{
static
unsigned
int
m_z
=
NUMBER1
;
static
unsigned
int
m_w
=
NUMBER2
;
if
(
fReset
)
{
m_z
=
NUMBER1
;
m_w
=
NUMBER2
;
}
m_z
=
36969
*
(
m_z
&
65535
)
+
(
m_z
>>
16
);
m_w
=
18000
*
(
m_w
&
65535
)
+
(
m_w
>>
16
);
return
(
m_z
<<
16
)
+
m_w
;
}
static
inline
word
Abc_RandomW
(
int
fReset
)
{
return
((
word
)
Abc_Random
(
fReset
)
<<
32
)
|
((
word
)
Abc_Random
(
fReset
)
<<
0
);
}
// the returned buffer has 32 unused bytes at the end, filled with zeros
static
inline
void
*
Abc_FileReadContents
(
char
*
pFileName
,
int
*
pnFileSize
)
{
...
...
@@ -537,6 +513,8 @@ extern void Abc_QuickSort3( word * pData, int nSize, int fDecrease );
extern
void
Abc_QuickSortCostData
(
int
*
pCosts
,
int
nSize
,
int
fDecrease
,
word
*
pData
,
int
*
pResult
);
extern
int
*
Abc_QuickSortCost
(
int
*
pCosts
,
int
nSize
,
int
fDecrease
);
extern
unsigned
Abc_Random
(
int
fReset
);
extern
word
Abc_RandomW
(
int
fReset
);
ABC_NAMESPACE_HEADER_END
...
...
src/misc/util/utilSort.c
View file @
e72438b2
...
...
@@ -779,6 +779,41 @@ void Abc_QuickSortTest()
ABC_FREE
(
pData2
);
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
// Creates a sequence of random numbers.
// http://www.codeproject.com/KB/recipes/SimpleRNG.aspx
#define NUMBER1 3716960521u
#define NUMBER2 2174103536u
unsigned
Abc_Random
(
int
fReset
)
{
static
unsigned
int
m_z
=
NUMBER1
;
static
unsigned
int
m_w
=
NUMBER2
;
if
(
fReset
)
{
m_z
=
NUMBER1
;
m_w
=
NUMBER2
;
}
m_z
=
36969
*
(
m_z
&
65535
)
+
(
m_z
>>
16
);
m_w
=
18000
*
(
m_w
&
65535
)
+
(
m_w
>>
16
);
return
(
m_z
<<
16
)
+
m_w
;
}
word
Abc_RandomW
(
int
fReset
)
{
return
((
word
)
Abc_Random
(
fReset
)
<<
32
)
|
((
word
)
Abc_Random
(
fReset
)
<<
0
);
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
...
...
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