Commit af9a253a authored by Masahiko Sakai's avatar Masahiko Sakai

version 1.00

parents
File added
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.114514924">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.114514924" moduleId="org.eclipse.cdt.core.settings" name="デフォルト">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description="" id="0.114514924" name="デフォルト" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.114514924." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.725442348" name="ツールチェーンなし" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.725442348.436375175" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.1165131656" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make ビルダー" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1258053810" name="ライブラリー設定フォルダー" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1047628829" name="アセンブリー" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.440652964" languageId="org.eclipse.cdt.core.assembly" languageName="アセンブリー" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1368023086" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1795190116" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1368816036" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.2011086387" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="gpw-solver-2.12.null.1091620089" name="gpw-solver-2.12"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="0.114514924">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gpw-solver-2.11a</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
/******************************************************************************************[FEnv.C]
Copyright (c) 2005-2010, Niklas Een, Niklas Sorensson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************/
#include "FEnv.h"
namespace FEnv {
vec<NodeData> nodes;
Map<NodeData, int> uniqueness_table;
vec<int> stack;
}
//=================================================================================================
static
bool eval(Formula f, AMap<char>& values, FEnv::CompMap<char>& memo)
{
if (Const_p(f))
return !sign(f);
else if (Atom_p(f))
return sign(f) ? !values.at(f) : values.at(f);
else{
int ret = memo.at(f);
if (ret == -1){
if (Bin_p(f)){
bool l = eval(left(f), values, memo);
bool r = eval(left(f), values, memo);
if (op(f) == op_And)
ret = l & r;
else{
assert(op(f) == op_Equiv);
ret = (l ^ r) ^ 1; }
}else if (ITE_p(f)){
bool sel = eval(cond(f), values, memo);
bool tru = eval(tt (f), values, memo);
bool fal = eval(ff (f), values, memo);
ret = sel ? tru : fal;
}else{
assert(FA_p(f));
bool x = eval(FA_x(f), values, memo);
bool y = eval(FA_y(f), values, memo);
bool c = eval(FA_c(f), values, memo);
if (isCarry(f))
ret = ((int)x + (int) y + (int)c) >= 2;
else
ret = x ^ y ^ c;
}
memo.set(f, ret);
}
return sign(f) ? !ret : ret;
}
}
bool eval(Formula f, AMap<char>& values) {
FEnv::CompMap<char> memo(-1);;
return eval(f, values, memo); }
This diff is collapsed.
/******************************************************************************************[File.C]
Copyright (c) 2005-2010, Niklas Een, Niklas Sorensson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************/
#include "File.h"
void File::open(int file_descr, FileMode m, bool own)
{
if (fd != -1) ::close(fd);
fd = file_descr;
mode = m;
own_fd = own;
pos = 0;
buf = xmalloc<uchar>(File_BufSize);
if (mode == READ) size = read(fd, buf, File_BufSize);
else size = -1;
}
void File::open(cchar* name, cchar* mode_)
{
if (fd != -1) ::close(fd);
bool has_r = strchr(mode_, 'r') != NULL;
bool has_w = strchr(mode_, 'w') != NULL;
bool has_a = strchr(mode_, 'a') != NULL;
bool has_p = strchr(mode_, '+') != NULL;
assert(!(has_r && has_w));
assert(has_r || has_w || has_a);
int mask = 0;
if (has_p) mask |= O_RDWR;
else if (has_r) mask |= O_RDONLY;
else mask |= O_WRONLY;
if (!has_r) mask |= O_CREAT;
if (has_w) mask |= O_TRUNC;
fd = open64(name, mask, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
if (fd != -1){
mode = has_r ? READ : WRITE;
own_fd = true;
pos = 0;
if (has_a) lseek64(fd, 0, SEEK_END);
buf = xmalloc<uchar>(File_BufSize);
if (mode == READ) size = read(fd, buf, File_BufSize);
else size = -1;
}
}
void File::close(void)
{
if (fd == -1) return;
if (mode == WRITE)
flush();
xfree(buf); buf = NULL;
if (own_fd)
::close(fd);
fd = -1;
}
void File::seek(int64 file_pos, int whence)
{
if (mode == WRITE){
flush();
pos = 0;
lseek64(fd, file_pos, whence);
}else{
if (whence == SEEK_CUR) lseek64(fd, file_pos - (size - pos), SEEK_CUR);
else lseek64(fd, file_pos, whence);
size = read(fd, buf, File_BufSize);
pos = 0;
}
}
int64 File::tell(void)
{
if (mode == WRITE)
return lseek64(fd, 0, SEEK_CUR);
else
return lseek64(fd, 0, SEEK_CUR) - (size - pos);
}
//=================================================================================================
// Marshaling:
void putUInt(File& out, uint64 val)
{
if (val < 0x20000000){
uint v = (uint)val;
if (v < 0x80)
out.putChar(v);
else{
if (v < 0x2000)
out.putChar(0x80 | (v >> 8)),
out.putChar((uchar)v);
else if (v < 0x200000)
out.putChar(0xA0 | (v >> 16)),
out.putChar((uchar)(v >> 8)),
out.putChar((uchar)v);
else
out.putChar((v >> 24) | 0xC0),
out.putChar((uchar)(v >> 16)),
out.putChar((uchar)(v >> 8)),
out.putChar((uchar)v);
}
}else
out.putChar(0xE0),
out.putChar((uchar)(val >> 56)),
out.putChar((uchar)(val >> 48)),
out.putChar((uchar)(val >> 40)),
out.putChar((uchar)(val >> 32)),
out.putChar((uchar)(val >> 24)),
out.putChar((uchar)(val >> 16)),
out.putChar((uchar)(val >> 8)),
out.putChar((uchar)val);
}
uint64 getUInt(File& in) // Returns 0 at end-of-file.
{
uint byte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7;
byte0 = in.getChar();
if (byte0 == (uint)EOF) return 0;
if (!(byte0 & 0x80))
return byte0;
else{
switch ((byte0 & 0x60) >> 5){
case 0:
byte1 = in.getChar();
return ((byte0 & 0x1F) << 8) | byte1;
case 1:
byte1 = in.getChar();
byte2 = in.getChar();
return ((byte0 & 0x1F) << 16) | (byte1 << 8) | byte2;
case 2:
byte1 = in.getChar();
byte2 = in.getChar();
byte3 = in.getChar();
return ((byte0 & 0x1F) << 24) | (byte1 << 16) | (byte2 << 8) | byte3;
case 3:
byte0 = in.getChar();
byte1 = in.getChar();
byte2 = in.getChar();
byte3 = in.getChar();
byte4 = in.getChar();
byte5 = in.getChar();
byte6 = in.getChar();
byte7 = in.getChar();
return ((uint64)((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3) << 32)
| (uint64)((byte4 << 24) | (byte5 << 16) | (byte6 << 8) | byte7);
}
assert(false);
}
}
/******************************************************************************************[File.h]
Copyright (c) 2005-2010, Niklas Een, Niklas Sorensson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************/
#ifndef File_h
#define File_h
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#define lseek64 lseek // }- (disable explicit 64-bit support for FreeBSD...)
#define open64 ::open // }
//=================================================================================================
// A buffered file abstraction with only 'putChar()' and 'getChar()'.
#define File_BufSize 1024 // A small buffer seem to work just as fine as a big one (at least under Linux)
enum FileMode { READ, WRITE };
// WARNING! This code is not thoroughly tested. May contain bugs!
class File {
int fd; // Underlying file descriptor.
FileMode mode; // Reading or writing.
uchar* buf; // Read or write buffer.
int size; // Size of buffer (at end of file, less than 'File_BufSize').
int pos; // Current position in buffer
bool own_fd; // Do we own the file descriptor? If so, will close file in destructor.
public:
#define DEFAULTS fd(-1), mode(READ), buf(NULL), size(-1), pos(0), own_fd(true)
File(void) : DEFAULTS {}
File(int fd, FileMode mode, bool own_fd = true) : DEFAULTS {
open(fd, mode, own_fd); }
File(cchar* name, cchar* mode) : DEFAULTS {
open(name, mode); }
#undef DEFAULTS
~File(void) {
close(); }
void open(int fd, FileMode mode, bool own_fd = true); // Low-level open. If 'own_fd' is FALSE, descriptor will not be closed by destructor.
void open(cchar* name, cchar* mode); // FILE* compatible interface.
void close(void);
bool null(void) { // TRUE if no file is opened.
return fd == -1; }
int releaseDescriptor(void) { // Don't run UNIX function 'close()' on descriptor in 'File's 'close()'.
if (mode == READ)
lseek64(fd, pos - size, SEEK_CUR);
own_fd = false;
return fd; }
FileMode getMode(void) {
return mode; }
void setMode(FileMode m) {
if (m == mode) return;
if (m == READ){
flush();
size = read(fd, buf, File_BufSize);
}else{
lseek64(fd, pos - size, SEEK_CUR);
size = -1; }
mode = m;
pos = 0; }
int getCharQ(void) { // Quick version with minimal overhead -- don't call this in the wrong mode!
#ifdef PARANOID
assert(mode == READ);
#endif
if (pos < size) return (uchar)buf[pos++];
if (size < File_BufSize) return EOF;
size = read(fd, buf, File_BufSize);
pos = 0;
if (size == 0) return EOF;
return (uchar)buf[pos++]; }
int putCharQ(int chr) { // Quick version with minimal overhead -- don't call this in the wrong mode!
#ifdef PARANOID
assert(mode == WRITE);
#endif
if (pos == File_BufSize)
write(fd, buf, File_BufSize),
pos = 0;
return buf[pos++] = (uchar)chr; }
int getChar(void) {
if (mode == WRITE) setMode(READ);
return getCharQ(); }
int putChar(int chr) {
if (mode == READ) setMode(WRITE);
return putCharQ(chr); }
bool eof(void) {
assert(mode == READ);
if (pos < size) return false;
if (size < File_BufSize) return true;
size = read(fd, buf, File_BufSize);
pos = 0;
if (size == 0) return true;
return false; }
void flush(void) {
assert(mode == WRITE);
write(fd, buf, pos);
pos = 0; }
void seek(int64 pos, int whence = SEEK_SET);
int64 tell(void);
};
//=================================================================================================
// Some nice helper functions:
void putUInt (File& out, uint64 val);
uint64 getUInt (File& in);
macro uint64 encode64(int64 val) { return (val >= 0) ? (uint64)val << 1 : (((uint64)(~val) << 1) | 1); }
macro int64 decode64(uint64 val) { return ((val & 1) == 0) ? (int64)(val >> 1) : ~(int64)(val >> 1); }
macro void putInt (File& out, int64 val) { putUInt(out, encode64(val)); }
macro uint64 getInt (File& in) { return decode64(getUInt(in)); }
//=================================================================================================
#endif
/****************************************************************************************[Global.C]
Copyright (c) 2005-2010, Niklas Een, Niklas Sorensson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************/
#include <cassert>
#include <cstdarg>
#include <cstring>
#include <cstdio>
char* vnsprintf(const char* format, va_list args)
{
static FILE* dummy = fopen("/dev/null", "wb");
unsigned chars_written;
char* ret;
va_list args_copy;
#ifdef __va_copy
__va_copy (args_copy, args);
#else
args_copy = args;
#endif
chars_written = vfprintf(dummy, format, args);
ret = xmalloc<char>(chars_written + 1);
ret[chars_written] = 255;
args = args_copy;
vsprintf(ret, format, args);
assert(ret[chars_written] == 0);
return ret;
}
char* nsprintf(const char* format, ...)
{
va_list args;
va_start(args, format);
char* ret = vnsprintf(format, args);
va_end(args);
return ret;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
macro bool hasChar(cchar* text, int chr) {
while (*text != 0) if (*text++ == chr) return true;
return false; }
void splitString(cchar* text, cchar* seps, vec<char*>& out)
{
while (hasChar(seps, *text)) text++;
if (*text == 0) return;
cchar* start = text;
for(;;){
if (*text == 0 || hasChar(seps, *text)){
out.push(xstrndup(start, text-start));
while (hasChar(seps, *text)) text++;
if (*text == 0) return;
start = text;
}else
text++;
}
}
This diff is collapsed.
/*********************************************************************************[Hash_standard.h]
Copyright (c) 2005-2010, Niklas Een, Niklas Sorensson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************/
#ifndef Hash_standard_h
#define Hash_standard_h
//=================================================================================================
// Some Primes...
static int prime_twins[25] = { 31, 73, 151, 313, 643, 1291, 2593, 5233, 10501, 21013, 42073, 84181, 168451, 337219, 674701, 1349473, 2699299, 5398891, 10798093, 21596719, 43193641, 86387383, 172775299, 345550609, 691101253 };
//=================================================================================================
// Standard hash parameters:
template <class K> struct Hash { uint operator () (const K& key) const { return key.hash(); } };
template <class K> struct Equal { bool operator () (const K& key1, const K& key2) const { return key1 == key2; } };
template <class K> struct Hash_params {
static uint hash (K key) { return Hash <K>