diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2020-03-18 19:03:20 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2020-03-18 19:03:20 -0700 |
commit | e72438b2d3b83d9a5ac646a2499f4374b29ebfbd (patch) | |
tree | c5ceb4dbf53de7e8eb6385db95f50f1f3ec4a4c5 | |
parent | f8b1be8bbf588fb6e0f6362a79c56283ab11858f (diff) | |
download | abc-e72438b2d3b83d9a5ac646a2499f4374b29ebfbd.tar.gz abc-e72438b2d3b83d9a5ac646a2499f4374b29ebfbd.tar.bz2 abc-e72438b2d3b83d9a5ac646a2499f4374b29ebfbd.zip |
Downgrading random number generator to be not inlined.
-rw-r--r-- | src/misc/util/abc_global.h | 26 | ||||
-rw-r--r-- | src/misc/util/utilSort.c | 35 |
2 files changed, 37 insertions, 24 deletions
diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h index aac1515b..7b7029be 100644 --- a/src/misc/util/abc_global.h +++ b/src/misc/util/abc_global.h @@ -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 diff --git a/src/misc/util/utilSort.c b/src/misc/util/utilSort.c index 32154a7d..31890503 100644 --- a/src/misc/util/utilSort.c +++ b/src/misc/util/utilSort.c @@ -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 /// |