Fix mingw 32 bit build. (nw)

This commit is contained in:
couriersud 2017-02-17 19:38:15 +01:00
parent 0716d96514
commit 8536d065e2
6 changed files with 22 additions and 28 deletions

View File

@ -88,6 +88,7 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
@ -127,7 +128,6 @@
<ClCompile Include="..\devices\nld_74192.cpp" /> <ClCompile Include="..\devices\nld_74192.cpp" />
<ClCompile Include="..\devices\nld_74193.cpp" /> <ClCompile Include="..\devices\nld_74193.cpp" />
<ClCompile Include="..\devices\nld_74194.cpp" /> <ClCompile Include="..\devices\nld_74194.cpp" />
<ClCompile Include="..\devices\nld_74279.cpp" />
<ClCompile Include="..\devices\nld_74365.cpp" /> <ClCompile Include="..\devices\nld_74365.cpp" />
<ClCompile Include="..\devices\nld_7448.cpp" /> <ClCompile Include="..\devices\nld_7448.cpp" />
<ClCompile Include="..\devices\nld_7450.cpp" /> <ClCompile Include="..\devices\nld_7450.cpp" />
@ -144,7 +144,6 @@
<ClCompile Include="..\devices\nld_82S126.cpp" /> <ClCompile Include="..\devices\nld_82S126.cpp" />
<ClCompile Include="..\devices\nld_82S16.cpp" /> <ClCompile Include="..\devices\nld_82S16.cpp" />
<ClCompile Include="..\devices\nld_9310.cpp" /> <ClCompile Include="..\devices\nld_9310.cpp" />
<ClCompile Include="..\devices\nld_9312.cpp" />
<ClCompile Include="..\devices\nld_9316.cpp" /> <ClCompile Include="..\devices\nld_9316.cpp" />
<ClCompile Include="..\devices\nld_9322.cpp" /> <ClCompile Include="..\devices\nld_9322.cpp" />
<ClCompile Include="..\devices\nld_am2847.cpp" /> <ClCompile Include="..\devices\nld_am2847.cpp" />
@ -209,7 +208,6 @@
<ClInclude Include="..\devices\nld_74192.h" /> <ClInclude Include="..\devices\nld_74192.h" />
<ClInclude Include="..\devices\nld_74193.h" /> <ClInclude Include="..\devices\nld_74193.h" />
<ClInclude Include="..\devices\nld_74194.h" /> <ClInclude Include="..\devices\nld_74194.h" />
<ClInclude Include="..\devices\nld_74279.h" />
<ClInclude Include="..\devices\nld_74365.h" /> <ClInclude Include="..\devices\nld_74365.h" />
<ClInclude Include="..\devices\nld_7448.h" /> <ClInclude Include="..\devices\nld_7448.h" />
<ClInclude Include="..\devices\nld_7450.h" /> <ClInclude Include="..\devices\nld_7450.h" />
@ -226,7 +224,6 @@
<ClInclude Include="..\devices\nld_82S126.h" /> <ClInclude Include="..\devices\nld_82S126.h" />
<ClInclude Include="..\devices\nld_82S16.h" /> <ClInclude Include="..\devices\nld_82S16.h" />
<ClInclude Include="..\devices\nld_9310.h" /> <ClInclude Include="..\devices\nld_9310.h" />
<ClInclude Include="..\devices\nld_9312.h" />
<ClInclude Include="..\devices\nld_9316.h" /> <ClInclude Include="..\devices\nld_9316.h" />
<ClInclude Include="..\devices\nld_9322.h" /> <ClInclude Include="..\devices\nld_9322.h" />
<ClInclude Include="..\devices\nld_am2847.h" /> <ClInclude Include="..\devices\nld_am2847.h" />

View File

@ -186,9 +186,6 @@
<ClCompile Include="..\devices\nld_7473.cpp"> <ClCompile Include="..\devices\nld_7473.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\devices\nld_74279.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\devices\nld_4066.cpp"> <ClCompile Include="..\devices\nld_4066.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -228,9 +225,6 @@
<ClCompile Include="..\devices\nld_7474.cpp"> <ClCompile Include="..\devices\nld_7474.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\devices\nld_9312.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\devices\nld_82S126.cpp"> <ClCompile Include="..\devices\nld_82S126.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -434,9 +428,6 @@
<ClInclude Include="..\devices\nlid_proxy.h"> <ClInclude Include="..\devices\nlid_proxy.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\devices\nld_74279.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\devices\nld_log.h"> <ClInclude Include="..\devices\nld_log.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -470,9 +461,6 @@
<ClInclude Include="..\devices\nld_7474.h"> <ClInclude Include="..\devices\nld_7474.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\devices\nld_9312.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\devices\nld_74194.h"> <ClInclude Include="..\devices\nld_74194.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>

View File

@ -116,6 +116,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>

24
src/lib/netlist/devices/nlid_truthtable.cpp Normal file → Executable file
View File

@ -69,6 +69,8 @@ namespace netlist
size_t m_size; size_t m_size;
}; };
static const uint_least64_t one64 = static_cast<uint_least64_t>(1);
struct truthtable_desc_t struct truthtable_desc_t
{ {
truthtable_desc_t(unsigned NO, unsigned NI, bool *initialized, truthtable_desc_t(unsigned NO, unsigned NI, bool *initialized,
@ -159,7 +161,7 @@ namespace netlist
connect(m_Q[i], m_I[idx]); connect(m_Q[i], m_I[idx]);
// disable ignore for this inputs altogether. // disable ignore for this inputs altogether.
// FIXME: This shouldn't be necessary // FIXME: This shouldn't be necessary
disabled_ignore |= (1<<idx); disabled_ignore |= (one64 << idx);
} }
} }
@ -236,7 +238,7 @@ uint_least64_t truthtable_desc_t::set_bits(uint_least64_t v, uint_least64_t b)
uint_least64_t truthtable_desc_t::get_ignored_simple(uint_least64_t i) uint_least64_t truthtable_desc_t::get_ignored_simple(uint_least64_t i)
{ {
uint_least64_t m_enable = 0; uint_least64_t m_enable = 0;
for (size_t j=0; j<m_size; j++) for (uint_least64_t j=0; j<m_size; j++)
{ {
if (m_outs[j] != m_outs[i]) if (m_outs[j] != m_outs[i])
{ {
@ -250,24 +252,24 @@ uint_least64_t truthtable_desc_t::get_ignored_extended(uint_least64_t state)
{ {
// Determine all inputs which may be ignored ... // Determine all inputs which may be ignored ...
uint_least64_t ignore = 0; uint_least64_t ignore = 0;
for (unsigned j=0; j<m_NI; j++) for (std::size_t j=0; j<m_NI; j++)
{ {
if (m_outs[state] == m_outs[state ^ (1 << j)]) if (m_outs[state] == m_outs[state ^ (one64 << j)])
ignore |= (1<<j); ignore |= (one64 << j);
} }
/* Check all permutations of ign /* Check all permutations of ign
* We have to remove those where the ignored inputs * We have to remove those where the ignored inputs
* may change the output * may change the output
*/ */
uint_least64_t bits = (1<<count_bits(ignore)); uint_least64_t bits = (one64 << count_bits(ignore));
std::vector<bool> t(bits); std::vector<bool> t(bits);
for (size_t j=1; j<bits; j++) for (size_t j=1; j<bits; j++)
{ {
uint_least64_t tign = set_bits(ignore, j); uint_least64_t tign = set_bits(ignore, j);
t[j] = 0; t[j] = 0;
uint_least64_t bitsk=(1<<count_bits(tign)); uint_least64_t bitsk=(one64 << count_bits(tign));
for (size_t k=0; k<bitsk; k++) for (uint_least64_t k=0; k<bitsk; k++)
{ {
uint_least64_t b=set_bits(tign, k); uint_least64_t b=set_bits(tign, k);
if (m_outs[state] != m_outs[(state & ~tign) | b]) if (m_outs[state] != m_outs[(state & ~tign) | b])
@ -377,7 +379,7 @@ void truthtable_desc_t::setup(const std::vector<pstring> &truthtable, uint_least
{ {
pstring outs = out[j].trim(); pstring outs = out[j].trim();
if (outs.equals("1")) if (outs.equals("1"))
val = val | (1 << j); val = val | (one64 << j);
else else
nl_assert_always(outs.equals("0"), "Unknown value (not 0 or 1"); nl_assert_always(outs.equals("0"), "Unknown value (not 0 or 1");
netlist_time t = netlist_time::from_nsec(static_cast<unsigned long>(times[j].trim().as_long())); netlist_time t = netlist_time::from_nsec(static_cast<unsigned long>(times[j].trim().as_long()));
@ -399,7 +401,7 @@ void truthtable_desc_t::setup(const std::vector<pstring> &truthtable, uint_least
// determine ignore // determine ignore
std::vector<uint_least64_t> ign(m_size, all_set); std::vector<uint_least64_t> ign(m_size, all_set);
for (size_t i=0; i<m_size; i++) for (uint_least64_t i=0; i<m_size; i++)
{ {
if (ign[i] == all_set) if (ign[i] == all_set)
{ {
@ -415,7 +417,7 @@ void truthtable_desc_t::setup(const std::vector<pstring> &truthtable, uint_least
ign[i] = tign; ign[i] = tign;
/* don't need to recalculate similar ones */ /* don't need to recalculate similar ones */
uint_least64_t bitsk=(1<<count_bits(tign)); uint_least64_t bitsk=(one64 << count_bits(tign));
for (uint_least64_t k=0; k<bitsk; k++) for (uint_least64_t k=0; k<bitsk; k++)
{ {
uint_least64_t b=set_bits(tign, k); uint_least64_t b=set_bits(tign, k);

View File

@ -56,7 +56,7 @@ typedef __int128_t INT128;
//============================================================ //============================================================
// This will be autodetected // This will be autodetected
// #define PPMF_TYPE 0 //#define PPMF_TYPE 0
#define PPMF_TYPE_PMF 0 #define PPMF_TYPE_PMF 0
#define PPMF_TYPE_GNUC_PMF_CONV 1 #define PPMF_TYPE_GNUC_PMF_CONV 1
@ -92,6 +92,11 @@ typedef __int128_t INT128;
#else #else
#define PPMF_TYPE PPMF_TYPE_PMF #define PPMF_TYPE PPMF_TYPE_PMF
#endif #endif
#else
#undef PHAS_PMF_INTERNAL
#define PHAS_PMF_INTERNAL 0
#undef MEMBER_ABI
#define MEMBER_ABI
#endif #endif
#endif /* PCONFIG_H_ */ #endif /* PCONFIG_H_ */

View File

@ -177,6 +177,7 @@ namespace plib {
function_ptr t = *reinterpret_cast<function_ptr *>(&m_func); function_ptr t = *reinterpret_cast<function_ptr *>(&m_func);
return (obj->*t)(std::forward<Targs>(args)...); return (obj->*t)(std::forward<Targs>(args)...);
} }
bool is_set() { return m_func != nullptr; }
private: private:
generic_function m_func; generic_function m_func;
#if 0 && defined(_MSC_VER) #if 0 && defined(_MSC_VER)