diff --git a/src/systemc/dt/fx/scfx_rep.cc b/src/systemc/dt/fx/scfx_rep.cc index 3d10fb3f63..ae19fabe03 100644 --- a/src/systemc/dt/fx/scfx_rep.cc +++ b/src/systemc/dt/fx/scfx_rep.cc @@ -147,7 +147,7 @@ scfx_rep::scfx_rep(long a) : a = -a; m_sign = -1; } -# if defined(SC_LONG_64) +# if SC_LONG_64 m_wp = 1; m_mant[1] = static_cast(a); m_mant[2] = static_cast(a >> bits_in_word); @@ -171,7 +171,7 @@ scfx_rep::scfx_rep(unsigned long a) : m_mant.clear(); m_wp = m_msw = m_lsw = 2; m_state = normal; -# if defined(SC_LONG_64) +# if SC_LONG_64 m_wp = 1; m_mant[1] = static_cast(a); m_mant[2] = static_cast(a >> bits_in_word); @@ -1057,6 +1057,7 @@ print_other(scfx_string &s, const scfx_rep &a, sc_numrep numrep, int w_prefix, lsb = (b.m_lsw - b.m_wp) * bits_in_word + scfx_find_lsb(b.m_mant[b.m_lsw]); + } } diff --git a/src/systemc/ext/dt/bit/sc_proxy.hh b/src/systemc/ext/dt/bit/sc_proxy.hh index cf7bcbfc95..12e10725a4 100644 --- a/src/systemc/ext/dt/bit/sc_proxy.hh +++ b/src/systemc/ext/dt/bit/sc_proxy.hh @@ -816,7 +816,7 @@ sc_proxy::assign_(int a) return x; } -#if defined(SC_LONG_64) +#if SC_LONG_64 template inline X & sc_proxy::assign_(unsigned long a) diff --git a/src/systemc/ext/dt/fx/sc_fxdefs.hh b/src/systemc/ext/dt/fx/sc_fxdefs.hh index 8acfabfa58..c72a45afc2 100644 --- a/src/systemc/ext/dt/fx/sc_fxdefs.hh +++ b/src/systemc/ext/dt/fx/sc_fxdefs.hh @@ -50,6 +50,12 @@ #include "../../utils/sc_report_handler.hh" #include "../int/sc_nbutils.hh" +#if ULONG_MAX > 0xffffffffUL +# define SC_LONG_64 1 +#else +# define SC_LONG_64 0 +#endif + namespace sc_dt { diff --git a/src/systemc/ext/dt/fx/scfx_utils.hh b/src/systemc/ext/dt/fx/scfx_utils.hh index 37c57844c8..ec186c68f9 100644 --- a/src/systemc/ext/dt/fx/scfx_utils.hh +++ b/src/systemc/ext/dt/fx/scfx_utils.hh @@ -67,9 +67,9 @@ inline int scfx_find_msb(unsigned long x) { int i = 0; -# if defined(SC_LONG_64) +# if SC_LONG_64 MSB_STATEMENT(32); -# endif // defined(SC_LONG_64) +# endif // SC_LONG_64 MSB_STATEMENT(16); MSB_STATEMENT(8); MSB_STATEMENT(4); @@ -86,12 +86,12 @@ inline int scfx_find_lsb(unsigned long x) { int i; -# if defined(SC_LONG_64) +# if SC_LONG_64 i = 63; LSB_STATEMENT(32); # else i = 31; -# endif // defined(SC_LONG_64) +# endif // SC_LONG_64 LSB_STATEMENT(16); LSB_STATEMENT(8); LSB_STATEMENT(4);