Merge branch 'master' of ssh://vahagn.dyndns.org:21/home/vahagn/git/test
This commit is contained in:
@@ -6,14 +6,11 @@ struct a
|
|||||||
a()
|
a()
|
||||||
: m(0)
|
: m(0)
|
||||||
{}
|
{}
|
||||||
a( int e )
|
|
||||||
: m(e)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
// a( const a & _ )
|
a( const a & _ )
|
||||||
// : m( _.m+1)
|
: m( _.m+1)
|
||||||
// {}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct b : public a
|
struct b : public a
|
||||||
@@ -26,10 +23,9 @@ struct b : public a
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
a o;
|
b o;
|
||||||
a o2 = o;
|
b o2 = o;
|
||||||
std::cout << o2.m << std::endl;
|
std::cout << o2.m <<' '<<o2.n<< std::endl;
|
||||||
// std::cout << o2.m <<' '<<o2.n<< std::endl;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
15
default_arg.c
Normal file
15
default_arg.c
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void f( int i = 11 )
|
||||||
|
{
|
||||||
|
printf( "%d\n", i );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
f( 12 );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
329
getCurrentTime.h
Normal file
329
getCurrentTime.h
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
// toIntTest.cpp : Defines the entry point for the console application.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
|
||||||
|
|
||||||
|
#if defined( WIN32 )
|
||||||
|
//#define QUERY_PERFORMANCE_COUNTER
|
||||||
|
#define RDTSC
|
||||||
|
#else
|
||||||
|
#define GET_TIME_OF_DAY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RDTSC
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
class perf
|
||||||
|
{
|
||||||
|
__int64 r64;
|
||||||
|
|
||||||
|
__forceinline __int64 getCurrentTime()
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Serialized instruction ensure all previouse
|
||||||
|
// instructions a done befor reading the performance
|
||||||
|
// counter.
|
||||||
|
//
|
||||||
|
// cpuid
|
||||||
|
//
|
||||||
|
// Read the time stamp counter.
|
||||||
|
//
|
||||||
|
rdtsc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
__forceinline perf()
|
||||||
|
{
|
||||||
|
::Sleep( 0 );
|
||||||
|
__asm cpuid
|
||||||
|
r64 = getCurrentTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
__forceinline double elapsed()
|
||||||
|
{
|
||||||
|
__int64 now = getCurrentTime();
|
||||||
|
return double(now - r64 );
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
__int64 nCPUFrequency;
|
||||||
|
double dblCPUFrequency;
|
||||||
|
|
||||||
|
inline __int64 getCurrentTimeI()
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
rdtsc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double getCurrentTime()
|
||||||
|
{
|
||||||
|
// return double(getCurrentTimeI());
|
||||||
|
//
|
||||||
|
// The time stamp counter.
|
||||||
|
//
|
||||||
|
union {
|
||||||
|
__int64 r64;
|
||||||
|
__int32 r32[2];
|
||||||
|
} tsc;
|
||||||
|
//
|
||||||
|
// Read the time stamp counter.
|
||||||
|
//
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Serialized instruction ensure all previouse
|
||||||
|
// instructions a done befor reading the performance
|
||||||
|
// counter.
|
||||||
|
//
|
||||||
|
// cpuid
|
||||||
|
//
|
||||||
|
// Read the counter.
|
||||||
|
//
|
||||||
|
rdtsc
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// mov tsc.r32[0], eax
|
||||||
|
// mov tsc.r32[4], edx
|
||||||
|
movd xmm0,eax
|
||||||
|
movd xmm1,edx
|
||||||
|
pshufd xmm1, xmm0, 0xF7
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get time in seconds.
|
||||||
|
//
|
||||||
|
return double(tsc.r64);// / dblCPUFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initGetCurrentTimeLib_hlpr()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Use only one fixed CPU
|
||||||
|
//
|
||||||
|
BOOL b;
|
||||||
|
DWORD_PTR proc_affi;
|
||||||
|
DWORD_PTR sys_affi;
|
||||||
|
DWORD_PTR exclud_affi;
|
||||||
|
GetProcessAffinityMask( GetCurrentProcess(), &proc_affi, &sys_affi );
|
||||||
|
exclud_affi = proc_affi & ~sys_affi;
|
||||||
|
proc_affi = ( exclud_affi ) ? proc_affi : proc_affi;
|
||||||
|
int i = 0;
|
||||||
|
while (( proc_affi >>= 1 )) ++i;
|
||||||
|
proc_affi = 1 << i;
|
||||||
|
b = SetProcessAffinityMask( GetCurrentProcess(), proc_affi );
|
||||||
|
//
|
||||||
|
// Set the priority of thread high.
|
||||||
|
//
|
||||||
|
b = SetPriorityClass( GetCurrentProcess(), REALTIME_PRIORITY_CLASS );
|
||||||
|
b = SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );
|
||||||
|
//
|
||||||
|
// Get the frequency.
|
||||||
|
//
|
||||||
|
nCPUFrequency = 2000000000;
|
||||||
|
// QueryPerformanceFrequency(
|
||||||
|
// reinterpret_cast<LARGE_INTEGER*>( &nCPUFrequency ) );
|
||||||
|
//
|
||||||
|
// Frequency counter supported in CPUs of family x86
|
||||||
|
// starting from Pentium 4 or Pentium 3. So for old CPUs
|
||||||
|
// this will not work.
|
||||||
|
//
|
||||||
|
// If CPU doesn't support performance counter then just return.
|
||||||
|
//
|
||||||
|
if ( !nCPUFrequency )
|
||||||
|
puts("WARNING: This CPU doesn't support QueryPerformanceFrequency.");
|
||||||
|
//
|
||||||
|
// Convert to double.
|
||||||
|
//
|
||||||
|
dblCPUFrequency = double(nCPUFrequency);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef QUERY_PERFORMANCE_COUNTER
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
double dblCPUFrequency;
|
||||||
|
inline double getCurrentTime()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// This call must be quite fast. Since, in x86 architectur
|
||||||
|
// it is one instruction. Yet WIN32 API might added some
|
||||||
|
// additional processing.
|
||||||
|
//
|
||||||
|
// \todo Vahagn: add our assembly optimised function.
|
||||||
|
//
|
||||||
|
__int64 nCPUTickCount;
|
||||||
|
QueryPerformanceCounter(
|
||||||
|
reinterpret_cast<LARGE_INTEGER*>( &nCPUTickCount )
|
||||||
|
);
|
||||||
|
//
|
||||||
|
// Get time in seconds.
|
||||||
|
//
|
||||||
|
return double(nCPUTickCount) / dblCPUFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initGetCurrentTimeLib_hlpr()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Use only one fixed CPU
|
||||||
|
//
|
||||||
|
BOOL b;
|
||||||
|
DWORD_PTR proc_affi;
|
||||||
|
DWORD_PTR sys_affi;
|
||||||
|
DWORD_PTR exclud_affi;
|
||||||
|
GetProcessAffinityMask( GetCurrentProcess(), &proc_affi, &sys_affi );
|
||||||
|
exclud_affi = proc_affi & ~sys_affi;
|
||||||
|
proc_affi = ( exclud_affi ) ? proc_affi : proc_affi;
|
||||||
|
int i = 0;
|
||||||
|
while (( proc_affi >>= 1 )) ++i;
|
||||||
|
proc_affi = 1 << i;
|
||||||
|
b = SetProcessAffinityMask( GetCurrentProcess(), proc_affi );
|
||||||
|
//
|
||||||
|
// Set the priority of thread high.
|
||||||
|
//
|
||||||
|
b = SetPriorityClass( GetCurrentProcess(), REALTIME_PRIORITY_CLASS );
|
||||||
|
b = SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );
|
||||||
|
//
|
||||||
|
// Get the frequency.
|
||||||
|
//
|
||||||
|
__int64 nCPUFrequency;
|
||||||
|
QueryPerformanceFrequency(
|
||||||
|
reinterpret_cast<LARGE_INTEGER*>( &nCPUFrequency )
|
||||||
|
);
|
||||||
|
//
|
||||||
|
// Frequency counter supported in CPUs of family x86
|
||||||
|
// starting from Pentium 4 or Pentium 3. So for old CPUs
|
||||||
|
// this will not work.
|
||||||
|
//
|
||||||
|
// If CPU doesn't support performance counter then just return.
|
||||||
|
//
|
||||||
|
if ( !nCPUFrequency )
|
||||||
|
puts("WARNING: This CPU doesn't support QueryPerformanceFrequency.");
|
||||||
|
//
|
||||||
|
// Convert to double.
|
||||||
|
//
|
||||||
|
dblCPUFrequency = double(nCPUFrequency);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GET_TIME_OF_DAY
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
inline double getCurrentTime()
|
||||||
|
{
|
||||||
|
timeval t;
|
||||||
|
gettimeofday(&t,0);
|
||||||
|
return (double)t.tv_sec + ((double)t.tv_usec/1000000.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void initGetCurrentTimeLib_hlpr()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void initGetCurrentTimeLib()
|
||||||
|
{
|
||||||
|
initGetCurrentTimeLib_hlpr();
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
for ( int j=0; j < 10000; ++j )
|
||||||
|
{
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate the time expectation and dispersion
|
||||||
|
// of getCurrentTime on this CPU.
|
||||||
|
//
|
||||||
|
const int nProbeCount = 100000;
|
||||||
|
double dblTimeExpect = 0.;
|
||||||
|
double dblTimeDispersia = 0.;
|
||||||
|
for ( int i = nProbeCount; i; --i )
|
||||||
|
{
|
||||||
|
register double dblTimeBase = getCurrentTime();
|
||||||
|
register double dblTimeCurrent = getCurrentTime();
|
||||||
|
double dblTimeDelta = dblTimeCurrent - dblTimeBase;
|
||||||
|
dblTimeExpect += dblTimeDelta;
|
||||||
|
dblTimeDispersia += dblTimeDelta * dblTimeDelta;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// finalize.
|
||||||
|
//
|
||||||
|
dblTimeExpect /= double( nProbeCount );
|
||||||
|
dblTimeDispersia = dblTimeDispersia / double( nProbeCount )
|
||||||
|
- dblTimeExpect * dblTimeExpect;
|
||||||
|
printf( "Expectation: %f\n"
|
||||||
|
"Dispersion: %f\n",
|
||||||
|
dblTimeExpect,
|
||||||
|
sqrt(dblTimeDispersia) );
|
||||||
|
puts( "----------------------------------------------------" );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
const int nProbeCount = 1000;
|
||||||
|
double* ddd = new double[ nProbeCount ];
|
||||||
|
double* p = ddd;
|
||||||
|
double m = std::numeric_limits<double>::max();
|
||||||
|
for ( int i = nProbeCount; i; --i )
|
||||||
|
{
|
||||||
|
register double dblTimeBase = getCurrentTime();
|
||||||
|
register double dblTimeCurrent = getCurrentTime();
|
||||||
|
*p++ = dblTimeCurrent - dblTimeBase;
|
||||||
|
m = std::min( m, dblTimeCurrent - dblTimeBase );
|
||||||
|
// printf( "%10.1f\n", dblTimeCurrent - dblTimeBase );
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "%10.1f\n", m );
|
||||||
|
|
||||||
|
std::ofstream o;
|
||||||
|
o.open( "times.txt" );
|
||||||
|
p = ddd;
|
||||||
|
for ( int i = nProbeCount; i; --i )
|
||||||
|
{
|
||||||
|
o << *p++ << std::endl;
|
||||||
|
}
|
||||||
|
o << std::endl;
|
||||||
|
delete [] ddd;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
|
||||||
|
for ( int j = 0; j < 1000; ++j )
|
||||||
|
{
|
||||||
|
const int nProbeCount = 10000;
|
||||||
|
double m = 1e300;
|
||||||
|
for ( int i = nProbeCount; i; --i )
|
||||||
|
{
|
||||||
|
perf pc;
|
||||||
|
__asm cpuid
|
||||||
|
__asm cpuid
|
||||||
|
__asm cpuid
|
||||||
|
__asm cpuid
|
||||||
|
double c = pc.elapsed();
|
||||||
|
m = min( m, c );
|
||||||
|
}
|
||||||
|
std::cout << m << std::endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
9
hello.cpp
Normal file
9
hello.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main ( void )
|
||||||
|
{
|
||||||
|
puts( "Hello GCC!!!" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
0
std_vs_qt.sh
Normal file → Executable file
0
std_vs_qt.sh
Normal file → Executable file
10
string_size.cpp
Normal file
10
string_size.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
const char str [] ="This is a [] string.";
|
||||||
|
|
||||||
|
int main ( void )
|
||||||
|
{
|
||||||
|
std::cout << sizeof(str) << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
17
testTransform/Makefile
Normal file
17
testTransform/Makefile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
objects=main.o transform.o transfomr2.o
|
||||||
|
|
||||||
|
all: a.out
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -r $(objects)
|
||||||
|
|
||||||
|
a.out : main.o tansform.o transform2.o
|
||||||
|
g++ $(CPPFLAGS) $(objects)
|
||||||
|
|
||||||
|
main.o : main.cpp
|
||||||
|
|
||||||
|
transform.o : transform.cpp
|
||||||
|
|
||||||
|
transform2.o : transform2.cpp
|
||||||
|
|
||||||
@@ -488,61 +488,46 @@ void testTransform()
|
|||||||
<< "<a href=\"#_6\">pod::rectangle<double></a><br>"
|
<< "<a href=\"#_6\">pod::rectangle<double></a><br>"
|
||||||
<< "<a href=\"#_7\">trans*trans</a><br>"
|
<< "<a href=\"#_7\">trans*trans</a><br>"
|
||||||
<< "<a href=\"#_8\">trans<sup>-1</sup></a><br><br><br>";
|
<< "<a href=\"#_8\">trans<sup>-1</sup></a><br><br><br>";
|
||||||
#if 0
|
|
||||||
std::cout << "pod::point<int32>" << std::endl;
|
std::cout << "pod::point<int32>" << std::endl;
|
||||||
out << "<a name=\"#_1\"></a><table border=1><thead><H3>pod::point<int32></h3></thead>" << std::endl;
|
out << "<a name=\"#_1\"></a><table border=1><thead><H3>pod::point<int32></h3></thead>" << std::endl;
|
||||||
testAllPt<int32,nProbes>();
|
testAllPt<int32,nProbes>();
|
||||||
out << "</table><P>";
|
out << "</table><P>";
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::cout << "pod::point<int64>" << std::endl;
|
std::cout << "pod::point<int64>" << std::endl;
|
||||||
out << "<a name=\"#_2\"></a><table border=1><thead><H3>pod::point<int64></H3></thead>" << std::endl;
|
out << "<a name=\"#_2\"></a><table border=1><thead><H3>pod::point<int64></H3></thead>" << std::endl;
|
||||||
testAllPt<int64,nProbes>();
|
testAllPt<int64,nProbes>();
|
||||||
out << "</table><P>";
|
out << "</table><P>";
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::cout << "pod::point<double>" << std::endl;
|
std::cout << "pod::point<double>" << std::endl;
|
||||||
out << "<a name=\"#_3\"></a><table border=1><thead><H3>pod::point<double></H3></thead>" << std::endl;
|
out << "<a name=\"#_3\"></a><table border=1><thead><H3>pod::point<double></H3></thead>" << std::endl;
|
||||||
testAllPt<double,nProbes>();
|
testAllPt<double,nProbes>();
|
||||||
out << "</table><P>";
|
out << "</table><P>";
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
std::cout << "pod::rectangle<int32>" << std::endl;
|
std::cout << "pod::rectangle<int32>" << std::endl;
|
||||||
out << "<a name=\"#_4\"></a><table border=1><thead><H3>pod::rectangle<int32></H3></thead>" << std::endl;
|
out << "<a name=\"#_4\"></a><table border=1><thead><H3>pod::rectangle<int32></H3></thead>" << std::endl;
|
||||||
testAllRect<int32,nProbes>();
|
testAllRect<int32,nProbes>();
|
||||||
out << "</table><P>";
|
out << "</table><P>";
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::cout << "pod::rectangle<int64>" << std::endl;
|
std::cout << "pod::rectangle<int64>" << std::endl;
|
||||||
out << "<a name=\"#_5\"></a><table border=1><thead><H3>pod::rectangle<int64></H3></thead>" << std::endl;
|
out << "<a name=\"#_5\"></a><table border=1><thead><H3>pod::rectangle<int64></H3></thead>" << std::endl;
|
||||||
testAllRect<int64,nProbes>();
|
testAllRect<int64,nProbes>();
|
||||||
out << "</table><P>";
|
out << "</table><P>";
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::cout << "pod::rectangle<double>" << std::endl;
|
std::cout << "pod::rectangle<double>" << std::endl;
|
||||||
out << "<a name=\"#_6\"></a><table border=1><thead><H3>pod::rectangle<double></H3></thead>" << std::endl;
|
out << "<a name=\"#_6\"></a><table border=1><thead><H3>pod::rectangle<double></H3></thead>" << std::endl;
|
||||||
testAllRect<double,nProbes>();
|
testAllRect<double,nProbes>();
|
||||||
out << "</table><P>";
|
out << "</table><P>";
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::cout << "trans*trans" << std::endl;
|
std::cout << "trans*trans" << std::endl;
|
||||||
out << "<a name=\"#_7\"></a><table border=1><thead><H3>trans*trans</H3></thead>" << std::endl;
|
out << "<a name=\"#_7\"></a><table border=1><thead><H3>trans*trans</H3></thead>" << std::endl;
|
||||||
testAllTrans1x1<nProbes>();
|
testAllTrans1x1<nProbes>();
|
||||||
out << "</table><P>";
|
out << "</table><P>";
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::cout << "inverse trans" << std::endl;
|
std::cout << "inverse trans" << std::endl;
|
||||||
out << "<a name=\"#_8\"></a><table border=1><thead><H3>trans<sup>-1</sup></H3></thead>" << std::endl;
|
out << "<a name=\"#_8\"></a><table border=1><thead><H3>trans<sup>-1</sup></H3></thead>" << std::endl;
|
||||||
testAllTransInverse<nProbes>();
|
testAllTransInverse<nProbes>();
|
||||||
out << "</table><P>";
|
out << "</table><P>";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main ( )
|
void main ( )
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="D:\work\prj\fw\xmain\src;D:\work\prj\fw\main\3rd_party\qt\4.3.3\win32\include"
|
AdditionalIncludeDirectories="D:\work\prj\fw\xmain\src;D:\work\prj\fw\xmain\src\base"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;SSE_OPTIMIZATIONS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;SSE_OPTIMIZATIONS"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
@@ -184,11 +184,29 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\transform.cpp"
|
RelativePath="..\..\fw\xmain\src\base\transform.cpp"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)\$(InputName)1.obj"
|
||||||
|
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)\$(InputName)1.obj"
|
||||||
|
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\transform.h"
|
RelativePath="..\..\fw\xmain\src\base\transform.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
@@ -208,11 +226,11 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\sseprim.h"
|
RelativePath="..\..\fw\xmain\src\base\sseprim.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\ssetypes.h"
|
RelativePath="..\..\fw\xmain\src\base\ssetypes.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
* contained herein except pursuant to a valid written license from Synopsys.
|
* contained herein except pursuant to a valid written license from Synopsys.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "base/type-traits2.h"
|
#include "type-traits2.h"
|
||||||
//#include "ssetypes.h"
|
#include "ssetypes.h"
|
||||||
|
|
||||||
#include "transform.h"
|
#include "transform.h"
|
||||||
#include "base/constants.h"
|
#include "constants.h"
|
||||||
|
|
||||||
namespace base
|
namespace base
|
||||||
{
|
{
|
||||||
@@ -109,8 +109,6 @@ namespace base
|
|||||||
pModifyFunLongToInt modifyLongToIntFunTbl[transformTypeMAX];
|
pModifyFunLongToInt modifyLongToIntFunTbl[transformTypeMAX];
|
||||||
pModifyFunIntToInt modifyIntToIntFunTbl[transformTypeMAX];
|
pModifyFunIntToInt modifyIntToIntFunTbl[transformTypeMAX];
|
||||||
pModifyFunLongToLong modifyLongToLongFunTbl[transformTypeMAX];
|
pModifyFunLongToLong modifyLongToLongFunTbl[transformTypeMAX];
|
||||||
pModifyFunLongLongToLongLong modifyLongLongToLongLongFunTbl[transformTypeMAX];
|
|
||||||
|
|
||||||
pModifyRectFunLongToLong modifyRectLongToLongFunTbl[transformTypeMAX];
|
pModifyRectFunLongToLong modifyRectLongToLongFunTbl[transformTypeMAX];
|
||||||
pModifyRectFunDblToDbl modifyRectDblToDblFunTbl[transformTypeMAX];
|
pModifyRectFunDblToDbl modifyRectDblToDblFunTbl[transformTypeMAX];
|
||||||
pModifyRectFunIntToInt modifyRectIntToIntFunTbl[transformTypeMAX];
|
pModifyRectFunIntToInt modifyRectIntToIntFunTbl[transformTypeMAX];
|
||||||
@@ -136,7 +134,7 @@ namespace base
|
|||||||
return std::tr1::is_floating_point<oC>::value ?
|
return std::tr1::is_floating_point<oC>::value ?
|
||||||
pod::point<oC>((oC)tmp.X(),(oC)tmp.Y())
|
pod::point<oC>((oC)tmp.X(),(oC)tmp.Y())
|
||||||
:
|
:
|
||||||
pod::point<oC>((oC)base::setSaturated<oC>(tmp.X()),(oC)base::setSaturated<oC>(tmp.Y()));
|
pod::point<oC>((oC)base::round(tmp.X()),(oC)base::round(tmp.Y()));
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
/// Modify a point using scale and offset transform.
|
/// Modify a point using scale and offset transform.
|
||||||
@@ -149,7 +147,7 @@ namespace base
|
|||||||
return std::tr1::is_floating_point<oC>::value ?
|
return std::tr1::is_floating_point<oC>::value ?
|
||||||
pod::point<oC>((oC)tmp.X(),(oC)tmp.Y())
|
pod::point<oC>((oC)tmp.X(),(oC)tmp.Y())
|
||||||
:
|
:
|
||||||
pod::point<oC>((oC)base::setSaturated<oC>(tmp.X()),(oC)base::setSaturated<oC>(tmp.Y()));
|
pod::point<oC>((oC)base::round(tmp.X()),(oC)base::round(tmp.Y()));
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
/// Modify a point using a general transform.
|
/// Modify a point using a general transform.
|
||||||
@@ -162,7 +160,7 @@ namespace base
|
|||||||
return std::tr1::is_floating_point<oC>::value ?
|
return std::tr1::is_floating_point<oC>::value ?
|
||||||
pod::point<oC>((oC)tmp.X(),(oC)tmp.Y())
|
pod::point<oC>((oC)tmp.X(),(oC)tmp.Y())
|
||||||
:
|
:
|
||||||
pod::point<oC>((oC)base::setSaturated<oC>(tmp.X()),(oC)base::setSaturated<oC>(tmp.Y()));
|
pod::point<oC>((oC)base::round(tmp.X()),(oC)base::round(tmp.Y()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class iC,class oC>
|
template <class iC,class oC>
|
||||||
@@ -178,7 +176,7 @@ namespace base
|
|||||||
return std::tr1::is_floating_point<oC>::value ?
|
return std::tr1::is_floating_point<oC>::value ?
|
||||||
pod::point<oC>( (oC)(d.getX()), (oC)(d.getY()))
|
pod::point<oC>( (oC)(d.getX()), (oC)(d.getY()))
|
||||||
:
|
:
|
||||||
pod::point<oC>( (oC)base::setSaturated<oC>(d.getX()), (oC)base::setSaturated<oC>(d.getY()));
|
pod::point<oC>( (oC)base::round(d.getX()), (oC)base::round(d.getY()));
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
/// Modify a point using standard transform with magnification
|
/// Modify a point using standard transform with magnification
|
||||||
@@ -196,7 +194,7 @@ namespace base
|
|||||||
return std::tr1::is_floating_point<oC>::value ?
|
return std::tr1::is_floating_point<oC>::value ?
|
||||||
pod::point<oC>( (oC)(d.getX()), (oC)(d.getY()))
|
pod::point<oC>( (oC)(d.getX()), (oC)(d.getY()))
|
||||||
:
|
:
|
||||||
pod::point<oC>( (oC)base::setSaturated<oC>(d.getX()), (oC)base::setSaturated<oC>(d.getY()));
|
pod::point<oC>( (oC)base::round(d.getX()), (oC)base::round(d.getY()));
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
/// Modify a point using resolution transform.
|
/// Modify a point using resolution transform.
|
||||||
@@ -205,38 +203,29 @@ namespace base
|
|||||||
pod::point<oC> GXX_HIDDEN modifyResolution( const transform &T, pod::point<iC> xy )
|
pod::point<oC> GXX_HIDDEN modifyResolution( const transform &T, pod::point<iC> xy )
|
||||||
{
|
{
|
||||||
pod::point<double> tmp = xy % T.getDiagonal();
|
pod::point<double> tmp = xy % T.getDiagonal();
|
||||||
if (T.getNext())
|
if (T.getNext()) {
|
||||||
{
|
if (std::tr1::is_double<oC>::value) {
|
||||||
if ( std::tr1::is_double<oC>::value )
|
pod::point<double> tmp2 = pod::point<double>((double)tmp.X(),
|
||||||
{
|
(double)tmp.Y());
|
||||||
pod::point<double> tmp2((double)tmp.X(),
|
|
||||||
(double)tmp.Y());
|
|
||||||
return T.getNext()->modifyDblToDbl(tmp2);
|
return T.getNext()->modifyDblToDbl(tmp2);
|
||||||
}
|
} else if (std::tr1::is_long<oC>::value) {
|
||||||
else if ( std::tr1::is_i64<oC>::value )
|
pod::point<long> tmp2 = pod::point<long>((long)base::round(tmp.X()),
|
||||||
{
|
(long)base::round(tmp.Y()));
|
||||||
pod::point<i64> tmp2((i64)base::setSaturated<i64>(tmp.X()),
|
|
||||||
(i64)base::setSaturated<i64>(tmp.Y()));
|
|
||||||
return T.getNext()->modifyLongToLong(tmp2);
|
return T.getNext()->modifyLongToLong(tmp2);
|
||||||
}
|
} else if (std::tr1::is_int<oC>::value) {
|
||||||
else if ( std::tr1::is_int<oC>::value )
|
pod::point<long> tmp2 = pod::point<long>((long)base::round(tmp.X()),
|
||||||
{
|
(long)base::round(tmp.Y()));
|
||||||
pod::point<i64> tmp2((i64)base::setSaturated<i64>(tmp.X()),
|
|
||||||
(i64)base::setSaturated<i64>(tmp.Y()));
|
|
||||||
return T.getNext()->modifyLongToInt(tmp2);
|
return T.getNext()->modifyLongToInt(tmp2);
|
||||||
}
|
} else if (std::tr1::is_short<oC>::value) {
|
||||||
else if ( std::tr1::is_short<oC>::value )
|
pod::point<long> tmp2 = pod::point<long>((long)base::round(tmp.X()),
|
||||||
{
|
(long)base::round(tmp.Y()));
|
||||||
pod::point<i64> tmp2((i64)base::setSaturated<i64>(tmp.X()),
|
|
||||||
(i64)base::setSaturated<i64>(tmp.Y()));
|
|
||||||
return T.getNext()->modifyLongToShort(tmp2);
|
return T.getNext()->modifyLongToShort(tmp2);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return std::tr1::is_floating_point<oC>::value ?
|
return std::tr1::is_floating_point<oC>::value ?
|
||||||
pod::point<oC>((oC)tmp.X(),(oC)tmp.Y()) :
|
pod::point<oC>((oC)tmp.X(),(oC)tmp.Y()) :
|
||||||
pod::point<oC>((oC)base::setSaturated<oC>(tmp.X()),
|
pod::point<oC>((oC)base::round(tmp.X()),
|
||||||
(oC)base::setSaturated<oC>(tmp.Y()));
|
(oC)base::round(tmp.Y()));
|
||||||
// Should not get here or something is missing.
|
// Should not get here or something is missing.
|
||||||
throw except::programError();
|
throw except::programError();
|
||||||
return pod::point<oC>((oC)0, (oC)0);
|
return pod::point<oC>((oC)0, (oC)0);
|
||||||
@@ -344,14 +333,14 @@ namespace base
|
|||||||
modifyDblToShortFunTbl[ScaleTransformType] = &modifyScale<double,short>;
|
modifyDblToShortFunTbl[ScaleTransformType] = &modifyScale<double,short>;
|
||||||
modifyDblToShortFunTbl[ResolutionTransformType] = &modifyResolution<double,short>;
|
modifyDblToShortFunTbl[ResolutionTransformType] = &modifyResolution<double,short>;
|
||||||
//
|
//
|
||||||
// i64 to short
|
// long to short
|
||||||
//
|
//
|
||||||
modifyLongToShortFunTbl[ScaleOffsetTransformType] = &modifyScaleOffset<i64,short>;
|
modifyLongToShortFunTbl[ScaleOffsetTransformType] = &modifyScaleOffset<long,short>;
|
||||||
modifyLongToShortFunTbl[GeneralTransformType] = &modifyGeneral<i64,short>;
|
modifyLongToShortFunTbl[GeneralTransformType] = &modifyGeneral<long,short>;
|
||||||
modifyLongToShortFunTbl[StdTransformType] = &modifyStd<i64,short>;
|
modifyLongToShortFunTbl[StdTransformType] = &modifyStd<long,short>;
|
||||||
modifyLongToShortFunTbl[StdTransformWithMagType] = &modifyStdMag<i64,short>;
|
modifyLongToShortFunTbl[StdTransformWithMagType] = &modifyStdMag<long,short>;
|
||||||
modifyLongToShortFunTbl[ScaleTransformType] = &modifyScale<i64,short>;
|
modifyLongToShortFunTbl[ScaleTransformType] = &modifyScale<long,short>;
|
||||||
modifyLongToShortFunTbl[ResolutionTransformType] = &modifyResolution<i64,short>;
|
modifyLongToShortFunTbl[ResolutionTransformType] = &modifyResolution<long,short>;
|
||||||
//
|
//
|
||||||
// int to short
|
// int to short
|
||||||
//
|
//
|
||||||
@@ -380,14 +369,14 @@ namespace base
|
|||||||
modifyDblToDblFunTbl[ScaleTransformType] = &modifyScale<double,double>;
|
modifyDblToDblFunTbl[ScaleTransformType] = &modifyScale<double,double>;
|
||||||
modifyDblToDblFunTbl[ResolutionTransformType] = &modifyResolution<double,double>;
|
modifyDblToDblFunTbl[ResolutionTransformType] = &modifyResolution<double,double>;
|
||||||
//
|
//
|
||||||
// i64 to int
|
// long to int
|
||||||
//
|
//
|
||||||
modifyLongToIntFunTbl[ScaleOffsetTransformType] = &modifyScaleOffset<i64,int>;
|
modifyLongToIntFunTbl[ScaleOffsetTransformType] = &modifyScaleOffset<long,int>;
|
||||||
modifyLongToIntFunTbl[GeneralTransformType] = &modifyGeneral<i64,int>;
|
modifyLongToIntFunTbl[GeneralTransformType] = &modifyGeneral<long,int>;
|
||||||
modifyLongToIntFunTbl[StdTransformType] = &modifyStd<i64,int>;
|
modifyLongToIntFunTbl[StdTransformType] = &modifyStd<long,int>;
|
||||||
modifyLongToIntFunTbl[StdTransformWithMagType] = &modifyStdMag<i64,int>;
|
modifyLongToIntFunTbl[StdTransformWithMagType] = &modifyStdMag<long,int>;
|
||||||
modifyLongToIntFunTbl[ScaleTransformType] = &modifyScale<i64,int>;
|
modifyLongToIntFunTbl[ScaleTransformType] = &modifyScale<long,int>;
|
||||||
modifyLongToIntFunTbl[ResolutionTransformType] = &modifyResolution<i64,int>;
|
modifyLongToIntFunTbl[ResolutionTransformType] = &modifyResolution<long,int>;
|
||||||
//
|
//
|
||||||
// int to int
|
// int to int
|
||||||
//
|
//
|
||||||
@@ -398,14 +387,14 @@ namespace base
|
|||||||
modifyIntToIntFunTbl[ScaleTransformType] = &modifyScale<int,int>;
|
modifyIntToIntFunTbl[ScaleTransformType] = &modifyScale<int,int>;
|
||||||
modifyIntToIntFunTbl[ResolutionTransformType] = &modifyResolution<int,int>;
|
modifyIntToIntFunTbl[ResolutionTransformType] = &modifyResolution<int,int>;
|
||||||
//
|
//
|
||||||
// i64 to i64
|
// long to long
|
||||||
//
|
//
|
||||||
modifyLongToLongFunTbl[ScaleOffsetTransformType] = &modifyScaleOffset<i64,i64>;
|
modifyLongToLongFunTbl[ScaleOffsetTransformType] = &modifyScaleOffset<long,long>;
|
||||||
modifyLongToLongFunTbl[GeneralTransformType] = &modifyGeneral<i64,i64>;
|
modifyLongToLongFunTbl[GeneralTransformType] = &modifyGeneral<long,long>;
|
||||||
modifyLongToLongFunTbl[StdTransformType] = &modifyStd<i64,i64>;
|
modifyLongToLongFunTbl[StdTransformType] = &modifyStd<long,long>;
|
||||||
modifyLongToLongFunTbl[StdTransformWithMagType] = &modifyStdMag<i64,i64>;
|
modifyLongToLongFunTbl[StdTransformWithMagType] = &modifyStdMag<long,long>;
|
||||||
modifyLongToLongFunTbl[ScaleTransformType] = &modifyScale<i64,i64>;
|
modifyLongToLongFunTbl[ScaleTransformType] = &modifyScale<long,long>;
|
||||||
modifyLongToLongFunTbl[ResolutionTransformType] = &modifyResolution<i64,i64>;
|
modifyLongToLongFunTbl[ResolutionTransformType] = &modifyResolution<long,long>;
|
||||||
//
|
//
|
||||||
/// Init get inverse func table.
|
/// Init get inverse func table.
|
||||||
//
|
//
|
||||||
@@ -457,12 +446,12 @@ namespace base
|
|||||||
//
|
//
|
||||||
// Initialize the rectangle modification function tables.
|
// Initialize the rectangle modification function tables.
|
||||||
//
|
//
|
||||||
modifyRectLongToLongFunTbl[ScaleOffsetTransformType] = modifyScaleOffsetRect<i64,i64>;
|
modifyRectLongToLongFunTbl[ScaleOffsetTransformType] = modifyScaleOffsetRect<long,long>;
|
||||||
modifyRectLongToLongFunTbl[GeneralTransformType] = modifyGeneralRect<i64,i64>;
|
modifyRectLongToLongFunTbl[GeneralTransformType] = modifyGeneralRect<long,long>;
|
||||||
modifyRectLongToLongFunTbl[StdTransformType] = modifyStdRect<i64,i64>;
|
modifyRectLongToLongFunTbl[StdTransformType] = modifyStdRect<long,long>;
|
||||||
modifyRectLongToLongFunTbl[StdTransformWithMagType] = modifyStdMagRect<i64,i64>;
|
modifyRectLongToLongFunTbl[StdTransformWithMagType] = modifyStdMagRect<long,long>;
|
||||||
modifyRectLongToLongFunTbl[ScaleTransformType] = modifyScaleRect<i64,i64>;
|
modifyRectLongToLongFunTbl[ScaleTransformType] = modifyScaleRect<long,long>;
|
||||||
modifyRectLongToLongFunTbl[ResolutionTransformType] = modifyResolutionRect<i64,i64>;
|
modifyRectLongToLongFunTbl[ResolutionTransformType] = modifyResolutionRect<long,long>;
|
||||||
|
|
||||||
modifyRectDblToDblFunTbl[ScaleOffsetTransformType] = modifyScaleOffsetRect<double,double>;
|
modifyRectDblToDblFunTbl[ScaleOffsetTransformType] = modifyScaleOffsetRect<double,double>;
|
||||||
modifyRectDblToDblFunTbl[GeneralTransformType] = modifyGeneralRect<double,double>;
|
modifyRectDblToDblFunTbl[GeneralTransformType] = modifyGeneralRect<double,double>;
|
||||||
@@ -1404,80 +1393,80 @@ std::ostream & operator << (std::ostream & os, const transform & t)
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Instantiate template with some arguments.
|
* Instantiate template with some arguments.
|
||||||
*/
|
*/
|
||||||
template void transform::modify<i32,i16>( const pod::point<i32>&, pod::point<i16>& ) const;
|
template void transform::modify<int,short>( const pod::point<int>&, pod::point<short>& ) const;
|
||||||
template void transform::modify<i64,i16>( const pod::point<i64>&, pod::point<i16>& ) const;
|
template void transform::modify<long,short>( const pod::point<long>&, pod::point<short>& ) const;
|
||||||
template void transform::modify<dbl,i16>( const pod::point<dbl>&, pod::point<i16>& ) const;
|
template void transform::modify<double,short>( const pod::point<double>&, pod::point<short>& ) const;
|
||||||
|
|
||||||
template void transform::modify<i32,i32>( const pod::point<i32>&, pod::point<i32>& ) const;
|
template void transform::modify<int,int>( const pod::point<int>&, pod::point<int>& ) const;
|
||||||
template void transform::modify<i64,i32>( const pod::point<i64>&, pod::point<i32>& ) const;
|
template void transform::modify<long,int>( const pod::point<long>&, pod::point<int>& ) const;
|
||||||
template void transform::modify<dbl,i32>( const pod::point<dbl>&, pod::point<i32>& ) const;
|
template void transform::modify<double,int>( const pod::point<double>&, pod::point<int>& ) const;
|
||||||
|
|
||||||
template void transform::modify<i32,i64>( const pod::point<i32>&, pod::point<i64>& ) const;
|
template void transform::modify<int,long>( const pod::point<int>&, pod::point<long>& ) const;
|
||||||
template void transform::modify<i64,i64>( const pod::point<i64>&, pod::point<i64>& ) const;
|
template void transform::modify<long,long>( const pod::point<long>&, pod::point<long>& ) const;
|
||||||
template void transform::modify<dbl,i64>( const pod::point<dbl>&, pod::point<i64>& ) const;
|
template void transform::modify<double,long>( const pod::point<double>&, pod::point<long>& ) const;
|
||||||
|
|
||||||
template void transform::modify<i32,dbl>( const pod::point<i32>&, pod::point<dbl>& ) const;
|
template void transform::modify<int,double>( const pod::point<int>&, pod::point<double>& ) const;
|
||||||
template void transform::modify<i64,dbl>( const pod::point<i64>&, pod::point<dbl>& ) const;
|
template void transform::modify<long,double>( const pod::point<long>&, pod::point<double>& ) const;
|
||||||
template void transform::modify<dbl,dbl>( const pod::point<dbl>&, pod::point<dbl>& ) const;
|
template void transform::modify<double,double>( const pod::point<double>&, pod::point<double>& ) const;
|
||||||
|
|
||||||
template void transform::modify<i32,i16>( const pod::rectangle<i32>&, pod::rectangle<i16>& ) const;
|
template void transform::modify<int,short>( const pod::rectangle<int>&, pod::rectangle<short>& ) const;
|
||||||
template void transform::modify<i64,i16>( const pod::rectangle<i64>&, pod::rectangle<i16>& ) const;
|
template void transform::modify<long,short>( const pod::rectangle<long>&, pod::rectangle<short>& ) const;
|
||||||
template void transform::modify<dbl,i16>( const pod::rectangle<dbl>&, pod::rectangle<i16>& ) const;
|
template void transform::modify<double,short>( const pod::rectangle<double>&, pod::rectangle<short>& ) const;
|
||||||
|
|
||||||
template void transform::modify<i32,i32>( const pod::rectangle<i32>&, pod::rectangle<i32>& ) const;
|
template void transform::modify<int,int>( const pod::rectangle<int>&, pod::rectangle<int>& ) const;
|
||||||
template void transform::modify<i64,i32>( const pod::rectangle<i64>&, pod::rectangle<i32>& ) const;
|
template void transform::modify<long,int>( const pod::rectangle<long>&, pod::rectangle<int>& ) const;
|
||||||
template void transform::modify<dbl,i32>( const pod::rectangle<dbl>&, pod::rectangle<i32>& ) const;
|
template void transform::modify<double,int>( const pod::rectangle<double>&, pod::rectangle<int>& ) const;
|
||||||
|
|
||||||
template void transform::modify<i32,i64>( const pod::rectangle<i32>&, pod::rectangle<i64>& ) const;
|
template void transform::modify<int,long>( const pod::rectangle<int>&, pod::rectangle<long>& ) const;
|
||||||
template void transform::modify<i64,i64>( const pod::rectangle<i64>&, pod::rectangle<i64>& ) const;
|
template void transform::modify<long,long>( const pod::rectangle<long>&, pod::rectangle<long>& ) const;
|
||||||
template void transform::modify<dbl,i64>( const pod::rectangle<dbl>&, pod::rectangle<i64>& ) const;
|
template void transform::modify<double,long>( const pod::rectangle<double>&, pod::rectangle<long>& ) const;
|
||||||
|
|
||||||
template void transform::modify<i32,dbl>( const pod::rectangle<i32>&, pod::rectangle<dbl>& ) const;
|
template void transform::modify<int,double>( const pod::rectangle<int>&, pod::rectangle<double>& ) const;
|
||||||
template void transform::modify<i64,dbl>( const pod::rectangle<i64>&, pod::rectangle<dbl>& ) const;
|
template void transform::modify<long,double>( const pod::rectangle<long>&, pod::rectangle<double>& ) const;
|
||||||
template void transform::modify<dbl,dbl>( const pod::rectangle<dbl>&, pod::rectangle<dbl>& ) const;
|
template void transform::modify<double,double>( const pod::rectangle<double>&, pod::rectangle<double>& ) const;
|
||||||
|
|
||||||
template void transform::modifyBBox<i32,i16>( const pod::rectangle<i32>&, pod::rectangle<i16>& ) const;
|
template void transform::modifyBBox<int,short>( const pod::rectangle<int>&, pod::rectangle<short>& ) const;
|
||||||
template void transform::modifyBBox<i64,i16>( const pod::rectangle<i64>&, pod::rectangle<i16>& ) const;
|
template void transform::modifyBBox<long,short>( const pod::rectangle<long>&, pod::rectangle<short>& ) const;
|
||||||
template void transform::modifyBBox<dbl,i16>( const pod::rectangle<dbl>&, pod::rectangle<i16>& ) const;
|
template void transform::modifyBBox<double,short>( const pod::rectangle<double>&, pod::rectangle<short>& ) const;
|
||||||
|
|
||||||
template void transform::modifyBBox<i32,i32>( const pod::rectangle<i32>&, pod::rectangle<i32>& ) const;
|
template void transform::modifyBBox<int,int>( const pod::rectangle<int>&, pod::rectangle<int>& ) const;
|
||||||
template void transform::modifyBBox<i64,i32>( const pod::rectangle<i64>&, pod::rectangle<i32>& ) const;
|
template void transform::modifyBBox<long,int>( const pod::rectangle<long>&, pod::rectangle<int>& ) const;
|
||||||
template void transform::modifyBBox<dbl,i32>( const pod::rectangle<dbl>&, pod::rectangle<i32>& ) const;
|
template void transform::modifyBBox<double,int>( const pod::rectangle<double>&, pod::rectangle<int>& ) const;
|
||||||
|
|
||||||
template void transform::modifyBBox<i32,i64>( const pod::rectangle<i32>&, pod::rectangle<i64>& ) const;
|
template void transform::modifyBBox<int,long>( const pod::rectangle<int>&, pod::rectangle<long>& ) const;
|
||||||
template void transform::modifyBBox<i64,i64>( const pod::rectangle<i64>&, pod::rectangle<i64>& ) const;
|
template void transform::modifyBBox<long,long>( const pod::rectangle<long>&, pod::rectangle<long>& ) const;
|
||||||
template void transform::modifyBBox<dbl,i64>( const pod::rectangle<dbl>&, pod::rectangle<i64>& ) const;
|
template void transform::modifyBBox<double,long>( const pod::rectangle<double>&, pod::rectangle<long>& ) const;
|
||||||
|
|
||||||
template void transform::modifyBBox<i32,dbl>( const pod::rectangle<i32>&, pod::rectangle<dbl>& ) const;
|
template void transform::modifyBBox<int,double>( const pod::rectangle<int>&, pod::rectangle<double>& ) const;
|
||||||
template void transform::modifyBBox<i64,dbl>( const pod::rectangle<i64>&, pod::rectangle<dbl>& ) const;
|
template void transform::modifyBBox<long,double>( const pod::rectangle<long>&, pod::rectangle<double>& ) const;
|
||||||
template void transform::modifyBBox<dbl,dbl>( const pod::rectangle<dbl>&, pod::rectangle<dbl>& ) const;
|
template void transform::modifyBBox<double,double>( const pod::rectangle<double>&, pod::rectangle<double>& ) const;
|
||||||
|
|
||||||
#if 0
|
#if defined( _MSC_VER )
|
||||||
template void transform::modify<int64,i16>( const pod::point<int64>&, pod::point<i16>& ) const;
|
template void transform::modify<int64,short>( const pod::point<int64>&, pod::point<short>& ) const;
|
||||||
template void transform::modify<int64,i32>( const pod::point<int64>&, pod::point<i32>& ) const;
|
template void transform::modify<int64,int>( const pod::point<int64>&, pod::point<int>& ) const;
|
||||||
template void transform::modify<int64,i64>( const pod::point<int64>&, pod::point<i64>& ) const;
|
template void transform::modify<int64,long>( const pod::point<int64>&, pod::point<long>& ) const;
|
||||||
template void transform::modify<int64,dbl>( const pod::point<int64>&, pod::point<dbl>& ) const;
|
template void transform::modify<int64,double>( const pod::point<int64>&, pod::point<double>& ) const;
|
||||||
template void transform::modify<i32,int64>( const pod::point<i32>&, pod::point<int64>& ) const;
|
template void transform::modify<int,int64>( const pod::point<int>&, pod::point<int64>& ) const;
|
||||||
template void transform::modify<i64,int64>( const pod::point<i64>&, pod::point<int64>& ) const;
|
template void transform::modify<long,int64>( const pod::point<long>&, pod::point<int64>& ) const;
|
||||||
template void transform::modify<dbl,int64>( const pod::point<dbl>&, pod::point<int64>& ) const;
|
template void transform::modify<double,int64>( const pod::point<double>&, pod::point<int64>& ) const;
|
||||||
template void transform::modify<int64,int64>( const pod::point<int64>&, pod::point<int64>& ) const;
|
template void transform::modify<int64,int64>( const pod::point<int64>&, pod::point<int64>& ) const;
|
||||||
|
|
||||||
template void transform::modify<int64,i16>( const pod::rectangle<int64>&, pod::rectangle<i16>& ) const;
|
template void transform::modify<int64,short>( const pod::rectangle<int64>&, pod::rectangle<short>& ) const;
|
||||||
template void transform::modify<int64,i32>( const pod::rectangle<int64>&, pod::rectangle<i32>& ) const;
|
template void transform::modify<int64,int>( const pod::rectangle<int64>&, pod::rectangle<int>& ) const;
|
||||||
template void transform::modify<int64,i64>( const pod::rectangle<int64>&, pod::rectangle<i64>& ) const;
|
template void transform::modify<int64,long>( const pod::rectangle<int64>&, pod::rectangle<long>& ) const;
|
||||||
template void transform::modify<int64,dbl>( const pod::rectangle<int64>&, pod::rectangle<dbl>& ) const;
|
template void transform::modify<int64,double>( const pod::rectangle<int64>&, pod::rectangle<double>& ) const;
|
||||||
template void transform::modify<i32,int64>( const pod::rectangle<i32>&, pod::rectangle<int64>& ) const;
|
template void transform::modify<int,int64>( const pod::rectangle<int>&, pod::rectangle<int64>& ) const;
|
||||||
template void transform::modify<i64,int64>( const pod::rectangle<i64>&, pod::rectangle<int64>& ) const;
|
template void transform::modify<long,int64>( const pod::rectangle<long>&, pod::rectangle<int64>& ) const;
|
||||||
template void transform::modify<dbl,int64>( const pod::rectangle<dbl>&, pod::rectangle<int64>& ) const;
|
template void transform::modify<double,int64>( const pod::rectangle<double>&, pod::rectangle<int64>& ) const;
|
||||||
template void transform::modify<int64,int64>( const pod::rectangle<int64>&, pod::rectangle<int64>& ) const;
|
template void transform::modify<int64,int64>( const pod::rectangle<int64>&, pod::rectangle<int64>& ) const;
|
||||||
|
|
||||||
template void transform::modifyBBox<int64,i16>( const pod::rectangle<int64>&, pod::rectangle<i16>& ) const;
|
template void transform::modifyBBox<int64,short>( const pod::rectangle<int64>&, pod::rectangle<short>& ) const;
|
||||||
template void transform::modifyBBox<int64,i32>( const pod::rectangle<int64>&, pod::rectangle<i32>& ) const;
|
template void transform::modifyBBox<int64,int>( const pod::rectangle<int64>&, pod::rectangle<int>& ) const;
|
||||||
template void transform::modifyBBox<int64,i64>( const pod::rectangle<int64>&, pod::rectangle<i64>& ) const;
|
template void transform::modifyBBox<int64,long>( const pod::rectangle<int64>&, pod::rectangle<long>& ) const;
|
||||||
template void transform::modifyBBox<int64,dbl>( const pod::rectangle<int64>&, pod::rectangle<dbl>& ) const;
|
template void transform::modifyBBox<int64,double>( const pod::rectangle<int64>&, pod::rectangle<double>& ) const;
|
||||||
template void transform::modifyBBox<i32,int64>( const pod::rectangle<i32>&, pod::rectangle<int64>& ) const;
|
template void transform::modifyBBox<int,int64>( const pod::rectangle<int>&, pod::rectangle<int64>& ) const;
|
||||||
template void transform::modifyBBox<i64,int64>( const pod::rectangle<i64>&, pod::rectangle<int64>& ) const;
|
template void transform::modifyBBox<long,int64>( const pod::rectangle<long>&, pod::rectangle<int64>& ) const;
|
||||||
template void transform::modifyBBox<dbl,int64>( const pod::rectangle<dbl>&, pod::rectangle<int64>& ) const;
|
template void transform::modifyBBox<double,int64>( const pod::rectangle<double>&, pod::rectangle<int64>& ) const;
|
||||||
template void transform::modifyBBox<int64,int64>( const pod::rectangle<int64>&, pod::rectangle<int64>& ) const;
|
template void transform::modifyBBox<int64,int64>( const pod::rectangle<int64>&, pod::rectangle<int64>& ) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "base/port.h"
|
#include "base/port.h"
|
||||||
#include "base/types.h"
|
|
||||||
#include "base/constants.h"
|
#include "base/constants.h"
|
||||||
#include "base/except.h"
|
#include "base/except.h"
|
||||||
#include "base/rectangle.h"
|
#include "base/rectangle.h"
|
||||||
@@ -149,29 +148,23 @@ namespace base
|
|||||||
extern pMultFun multFnTbl[transformTypeMAX*transformTypeMAX];
|
extern pMultFun multFnTbl[transformTypeMAX*transformTypeMAX];
|
||||||
|
|
||||||
typedef pod::point<short> (*pModifyFunDblToShort)(const transform &, pod::point<double>);
|
typedef pod::point<short> (*pModifyFunDblToShort)(const transform &, pod::point<double>);
|
||||||
typedef pod::point<short> (*pModifyFunLongToShort)(const transform &, pod::point<i64>);
|
typedef pod::point<short> (*pModifyFunLongToShort)(const transform &, pod::point<long>);
|
||||||
typedef pod::point<short> (*pModifyFunIntToShort)(const transform &, pod::point<int>);
|
typedef pod::point<short> (*pModifyFunIntToShort)(const transform &, pod::point<int>);
|
||||||
|
|
||||||
typedef pod::point<double> (*pModifyFunDblToDbl)(const transform &, pod::point<double>);
|
|
||||||
|
|
||||||
typedef pod::point<int> (*pModifyFunDblToInt)(const transform &, pod::point<double>);
|
typedef pod::point<int> (*pModifyFunDblToInt)(const transform &, pod::point<double>);
|
||||||
typedef pod::point<int> (*pModifyFunLongToInt)(const transform &, pod::point<i64>);
|
typedef pod::point<double> (*pModifyFunDblToDbl)(const transform &, pod::point<double>);
|
||||||
|
typedef pod::point<int> (*pModifyFunLongToInt)(const transform &, pod::point<long>);
|
||||||
typedef pod::point<int> (*pModifyFunIntToInt)(const transform &, pod::point<int>);
|
typedef pod::point<int> (*pModifyFunIntToInt)(const transform &, pod::point<int>);
|
||||||
|
typedef pod::point<long> (*pModifyFunLongToLong)(const transform &, pod::point<long>);
|
||||||
typedef pod::point<i64> (*pModifyFunLongToLong)(const transform &, pod::point<i64>);
|
|
||||||
typedef pod::point<i64> (*pModifyFunLongLongToLongLong)(const transform &, pod::point<i64>);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
/// Type definition for for transforming a rectangle of type double to
|
/// Type definition for for transforming a rectangle of type double to
|
||||||
/// another rectangle of type double.
|
/// another rectangle of type double.
|
||||||
//
|
//
|
||||||
typedef pod::rectangle<double> (*pModifyRectFunDblToDbl)(const transform &, const pod::rectangle<double> &);
|
typedef pod::rectangle<double> (*pModifyRectFunDblToDbl)(const transform &, const pod::rectangle<double> &);
|
||||||
//
|
//
|
||||||
/// Type definition for for transforming a rectangle of type i64 to
|
/// Type definition for for transforming a rectangle of type long to
|
||||||
/// another rectangle of type i64.
|
/// another rectangle of type long.
|
||||||
//
|
//
|
||||||
typedef pod::rectangle<i64> (*pModifyRectFunLongToLong)(const transform &, const pod::rectangle<i64> &);
|
typedef pod::rectangle<long> (*pModifyRectFunLongToLong)(const transform &, const pod::rectangle<long> &);
|
||||||
typedef pod::rectangle<i64> (*pModifyRectFunLongLongToLongLong)(const transform &, const pod::rectangle<i64> &);
|
|
||||||
//
|
//
|
||||||
/// Type definition for for transforming a rectangle of type int to
|
/// Type definition for for transforming a rectangle of type int to
|
||||||
/// another rectangle of type int.
|
/// another rectangle of type int.
|
||||||
@@ -186,9 +179,7 @@ namespace base
|
|||||||
extern pModifyFunLongToInt modifyLongToIntFunTbl[transformTypeMAX];
|
extern pModifyFunLongToInt modifyLongToIntFunTbl[transformTypeMAX];
|
||||||
extern pModifyFunIntToInt modifyIntToIntFunTbl[transformTypeMAX];
|
extern pModifyFunIntToInt modifyIntToIntFunTbl[transformTypeMAX];
|
||||||
extern pModifyFunLongToLong modifyLongToLongFunTbl[transformTypeMAX];
|
extern pModifyFunLongToLong modifyLongToLongFunTbl[transformTypeMAX];
|
||||||
extern pModifyFunLongLongToLongLong modifyLongLongToLongLongFunTbl[transformTypeMAX];
|
|
||||||
extern pModifyRectFunLongToLong modifyRectLongToLongFunTbl[transformTypeMAX];
|
extern pModifyRectFunLongToLong modifyRectLongToLongFunTbl[transformTypeMAX];
|
||||||
extern pModifyRectFunLongLongToLongLong modifyRectLongLongToLongLongFunTbl[transformTypeMAX];
|
|
||||||
extern pModifyRectFunDblToDbl modifyRectDblToDblFunTbl[transformTypeMAX];
|
extern pModifyRectFunDblToDbl modifyRectDblToDblFunTbl[transformTypeMAX];
|
||||||
extern pModifyRectFunIntToInt modifyRectIntToIntFunTbl[transformTypeMAX];
|
extern pModifyRectFunIntToInt modifyRectIntToIntFunTbl[transformTypeMAX];
|
||||||
|
|
||||||
@@ -243,7 +234,7 @@ namespace base
|
|||||||
|
|
||||||
typedef pod::point<short> (*pModifyFunLongToShort)(
|
typedef pod::point<short> (*pModifyFunLongToShort)(
|
||||||
const transform &T,
|
const transform &T,
|
||||||
pod::point<i64> xy );
|
pod::point<long> xy );
|
||||||
|
|
||||||
typedef pod::point<int> (*pModifyFunDblToInt)(
|
typedef pod::point<int> (*pModifyFunDblToInt)(
|
||||||
const transform &T,
|
const transform &T,
|
||||||
@@ -255,23 +246,19 @@ namespace base
|
|||||||
|
|
||||||
typedef pod::point<int> (*pModifyFunLongToInt)(
|
typedef pod::point<int> (*pModifyFunLongToInt)(
|
||||||
const transform &T,
|
const transform &T,
|
||||||
pod::point<i64> xy );
|
pod::point<long> xy );
|
||||||
|
|
||||||
typedef pod::point<i64> (*pModifyFunDblToLong)(
|
typedef pod::point<long> (*pModifyFunDblToLong)(
|
||||||
const transform &T,
|
const transform &T,
|
||||||
pod::point<double> xy );
|
pod::point<double> xy );
|
||||||
|
|
||||||
typedef pod::point<i64> (*pModifyFunIntToLong)(
|
typedef pod::point<long> (*pModifyFunIntToLong)(
|
||||||
const transform &T,
|
const transform &T,
|
||||||
pod::point<int> xy );
|
pod::point<int> xy );
|
||||||
|
|
||||||
typedef pod::point<i64> (*pModifyFunLongToLong)(
|
typedef pod::point<long> (*pModifyFunLongToLong)(
|
||||||
const transform &T,
|
const transform &T,
|
||||||
pod::point<i64> xy );
|
pod::point<long> xy );
|
||||||
|
|
||||||
typedef pod::point<i64> (*pModifyFunLongLongToLongLong)(
|
|
||||||
const transform &T,
|
|
||||||
pod::point<i64> xy );
|
|
||||||
|
|
||||||
typedef pod::point<double> (*pModifyFunDblToDbl)(
|
typedef pod::point<double> (*pModifyFunDblToDbl)(
|
||||||
const transform &T,
|
const transform &T,
|
||||||
@@ -283,7 +270,7 @@ namespace base
|
|||||||
|
|
||||||
typedef pod::point<double> (*pModifyFunLongToDbl)(
|
typedef pod::point<double> (*pModifyFunLongToDbl)(
|
||||||
const transform &T,
|
const transform &T,
|
||||||
pod::point<i64> xy );
|
pod::point<long> xy );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -445,13 +432,6 @@ namespace base
|
|||||||
//
|
//
|
||||||
/// Initialize the function tables.
|
/// Initialize the function tables.
|
||||||
//
|
//
|
||||||
/*!
|
|
||||||
Attention please: Since base is (currently) linked statically all
|
|
||||||
the global variables in transform.h get instantiated multiple times
|
|
||||||
in Windows (Linux is smarter here), hence all the shared libraries
|
|
||||||
(that intend to be running on Windows) should consider calling
|
|
||||||
initFnTables() in their initialization code.
|
|
||||||
*/
|
|
||||||
static void initFnTables();
|
static void initFnTables();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1004,21 +984,21 @@ public:
|
|||||||
//
|
//
|
||||||
pod::point<int> modifyDblToInt(pod::point<int>) const
|
pod::point<int> modifyDblToInt(pod::point<int>) const
|
||||||
{ return pod::point<int>(); }
|
{ return pod::point<int>(); }
|
||||||
pod::point<int> modifyDblToInt(pod::point<i64>) const
|
pod::point<int> modifyDblToInt(pod::point<long>) const
|
||||||
{ return pod::point<int>(); }
|
{ return pod::point<int>(); }
|
||||||
pod::point<short> modifyDblToShort(pod::point<int>) const
|
pod::point<short> modifyDblToShort(pod::point<int>) const
|
||||||
{ return pod::point<short>(); }
|
{ return pod::point<short>(); }
|
||||||
pod::point<short> modifyDblToShort(pod::point<i64>) const
|
pod::point<short> modifyDblToShort(pod::point<long>) const
|
||||||
{ return pod::point<short>(); }
|
{ return pod::point<short>(); }
|
||||||
pod::point<double> modifyDblToDbl(pod::point<int>) const
|
pod::point<double> modifyDblToDbl(pod::point<int>) const
|
||||||
{ return pod::point<double>(); }
|
{ return pod::point<double>(); }
|
||||||
pod::point<int> modifyIntToInt(pod::point<double>) const
|
pod::point<int> modifyIntToInt(pod::point<double>) const
|
||||||
{ return pod::point<int>(); }
|
{ return pod::point<int>(); }
|
||||||
pod::point<int> modifyIntToInt(pod::point<i64>) const
|
pod::point<int> modifyIntToInt(pod::point<long>) const
|
||||||
{ return pod::point<int>(); }
|
{ return pod::point<int>(); }
|
||||||
pod::point<short> modifyIntToShort(pod::point<double>) const
|
pod::point<short> modifyIntToShort(pod::point<double>) const
|
||||||
{ return pod::point<short>(); }
|
{ return pod::point<short>(); }
|
||||||
pod::point<short> modifyIntToShort(pod::point<i64>) const
|
pod::point<short> modifyIntToShort(pod::point<long>) const
|
||||||
{ return pod::point<short>(); }
|
{ return pod::point<short>(); }
|
||||||
pod::point<short> modifyLongToShort(pod::point<int>) const
|
pod::point<short> modifyLongToShort(pod::point<int>) const
|
||||||
{ return pod::point<short>(); }
|
{ return pod::point<short>(); }
|
||||||
@@ -1055,6 +1035,12 @@ public:
|
|||||||
{
|
{
|
||||||
return (*(modifyDblToDblFunTbl[type]))(*this, p);
|
return (*(modifyDblToDblFunTbl[type]))(*this, p);
|
||||||
}
|
}
|
||||||
|
#ifdef WIN32
|
||||||
|
pod::point<int64> modify(pod::point<int64> p) const
|
||||||
|
{
|
||||||
|
return (*(modifyLongToLongFunTbl[type]))(*this, p);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
pod::rectangle<C> modify(pod::rectangle<C> p) const
|
pod::rectangle<C> modify(pod::rectangle<C> p) const
|
||||||
@@ -1076,7 +1062,7 @@ public:
|
|||||||
return (*(modifyIntToShortFunTbl[type]))(*this, p);
|
return (*(modifyIntToShortFunTbl[type]))(*this, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
pod::point<short> modifyLongToShort(pod::point<i64> p) const
|
pod::point<short> modifyLongToShort(pod::point<long> p) const
|
||||||
{
|
{
|
||||||
return (*(modifyLongToShortFunTbl[type]))(*this, p);
|
return (*(modifyLongToShortFunTbl[type]))(*this, p);
|
||||||
}
|
}
|
||||||
@@ -1084,7 +1070,7 @@ public:
|
|||||||
//
|
//
|
||||||
/// Transform longs to ints.
|
/// Transform longs to ints.
|
||||||
//
|
//
|
||||||
pod::point<int> modifyLongToInt(pod::point<i64> p) const
|
pod::point<int> modifyLongToInt(pod::point<long> p) const
|
||||||
{
|
{
|
||||||
return (*(modifyLongToIntFunTbl[type]))(*this, p);
|
return (*(modifyLongToIntFunTbl[type]))(*this, p);
|
||||||
}
|
}
|
||||||
@@ -1092,20 +1078,12 @@ public:
|
|||||||
//
|
//
|
||||||
/// Transform longs to longs.
|
/// Transform longs to longs.
|
||||||
//
|
//
|
||||||
pod::point<i64> modifyLongToLong(pod::point<i64> p) const
|
pod::point<long> modifyLongToLong(pod::point<long> p) const
|
||||||
{
|
{
|
||||||
return (*(modifyLongToLongFunTbl[type]))(*this, p);
|
return (*(modifyLongToLongFunTbl[type]))(*this, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
pod::point<long> modify(pod::point<long> p) const
|
||||||
/// Transform longs to longs.
|
|
||||||
//
|
|
||||||
pod::point<i64> modifyLongLongToLongLong(pod::point<i64> p) const
|
|
||||||
{
|
|
||||||
return (*(modifyLongLongToLongLongFunTbl[type]))(*this, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
pod::point<i64> modify(pod::point<i64> p) const
|
|
||||||
{
|
{
|
||||||
return (*(modifyLongToLongFunTbl[type]))(*this, p);
|
return (*(modifyLongToLongFunTbl[type]))(*this, p);
|
||||||
}
|
}
|
||||||
@@ -1120,11 +1098,11 @@ public:
|
|||||||
return (*(modifyRectDblToDblFunTbl[type]))(*this, r);
|
return (*(modifyRectDblToDblFunTbl[type]))(*this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
pod::rectangle<i64> operator()(const pod::rectangle<i64> & r) const
|
pod::rectangle<long> operator()(const pod::rectangle<long> & r) const
|
||||||
{
|
{
|
||||||
return (*(modifyRectLongToLongFunTbl[type]))(*this, r);
|
return (*(modifyRectLongToLongFunTbl[type]))(*this, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
pod::rectangle<int> operator()(const pod::rectangle<int> & r) const
|
pod::rectangle<int> operator()(const pod::rectangle<int> & r) const
|
||||||
{
|
{
|
||||||
return (*(modifyRectIntToIntFunTbl[type]))(*this, r);
|
return (*(modifyRectIntToIntFunTbl[type]))(*this, r);
|
||||||
@@ -1135,7 +1113,7 @@ public:
|
|||||||
return (*(modifyDblToDblFunTbl[type]))(*this, p);
|
return (*(modifyDblToDblFunTbl[type]))(*this, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
pod::point<i64> operator()(const pod::point<i64> & p) const
|
pod::point<long> operator()(const pod::point<long> & p) const
|
||||||
{
|
{
|
||||||
return (*(modifyLongToLongFunTbl[type]))(*this, p);
|
return (*(modifyLongToLongFunTbl[type]))(*this, p);
|
||||||
}
|
}
|
||||||
@@ -1192,10 +1170,6 @@ public:
|
|||||||
/// Print a transform, mainly for debug purpose.
|
/// Print a transform, mainly for debug purpose.
|
||||||
//
|
//
|
||||||
void print(FILE *outStream, const char *linePrefix) const;
|
void print(FILE *outStream, const char *linePrefix) const;
|
||||||
//
|
|
||||||
/// Dump transform.
|
|
||||||
//
|
|
||||||
void dump( std::ostream& ) const;
|
|
||||||
|
|
||||||
}; // class transform
|
}; // class transform
|
||||||
|
|
||||||
@@ -1314,32 +1288,6 @@ namespace transformTest
|
|||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
/// Apply the chain to the rectangle r. Round after each
|
|
||||||
/// resolution change if needed.
|
|
||||||
//
|
|
||||||
pod::rectangle<double> apply(const pod::rectangle<double> &r, bool round = true) const
|
|
||||||
{
|
|
||||||
pod::point<double> ll = r.getLowerLeft();
|
|
||||||
pod::point<double> ur = r.getUpperRight();
|
|
||||||
for (int i = 0; i < chainSize; i++)
|
|
||||||
{
|
|
||||||
ll = ll % chain[i];
|
|
||||||
ur = ur % chain[i];
|
|
||||||
if (round)
|
|
||||||
{
|
|
||||||
ll = pod::point<double>(::round(ll.getX()),
|
|
||||||
::round(ll.getY()));
|
|
||||||
ur = pod::point<double>(::round(ur.getX()),
|
|
||||||
::round(ur.getY()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pod::rectangle<double>(ll, ur);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
/// Dump transform.
|
|
||||||
//
|
|
||||||
void dump( std::ostream& ) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -1453,39 +1401,6 @@ namespace transformTest
|
|||||||
{
|
{
|
||||||
return pod::point<double>(p * col1, p * col2) + offset;
|
return pod::point<double>(p * col1, p * col2) + offset;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
/// Apply the transformation to a double precision rectangle.
|
|
||||||
/// The result is the bounding rectangle of the transformed corners.
|
|
||||||
//
|
|
||||||
pod::rectangle<double> apply(const pod::rectangle<double> &r) const
|
|
||||||
{
|
|
||||||
using std::min;
|
|
||||||
using std::max;
|
|
||||||
|
|
||||||
pod::point<double> ll = pod::point<double>(r.getLowerLeft() * col1,
|
|
||||||
r.getLowerLeft() * col2);
|
|
||||||
pod::point<double> lr = pod::point<double>(r.getLowerRight() * col1,
|
|
||||||
r.getLowerRight() * col2);
|
|
||||||
pod::point<double> ul = pod::point<double>(r.getUpperLeft() * col1,
|
|
||||||
r.getUpperLeft() * col2);
|
|
||||||
pod::point<double> ur = pod::point<double>(r.getUpperRight() * col1,
|
|
||||||
r.getUpperRight() * col2);
|
|
||||||
double x1 = min(min(ll.getX(), lr.getX()),
|
|
||||||
min(ul.getX(), ur.getX()));
|
|
||||||
double y1 = min(min(ll.getY(), lr.getY()),
|
|
||||||
min(ul.getY(), ur.getY()));
|
|
||||||
double x2 = max(max(ll.getX(), lr.getX()),
|
|
||||||
max(ul.getX(), ur.getX()));
|
|
||||||
double y2 = max(max(ll.getY(), lr.getY()),
|
|
||||||
max(ul.getY(), ur.getY()));
|
|
||||||
|
|
||||||
return pod::rectangle<double>(x1 + offset.getX(), y1 + offset.getY(),
|
|
||||||
x2 + offset.getX(), y2 + offset.getY());
|
|
||||||
}
|
|
||||||
//
|
|
||||||
/// Dump transform.
|
|
||||||
//
|
|
||||||
void dump( std::ostream& os ) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace base
|
} // namespace base
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
* contained herein except pursuant to a valid written license from Synopsys.
|
* contained herein except pursuant to a valid written license from Synopsys.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "base/type-traits2.h"
|
#include "type-traits2.h"
|
||||||
#include "ssetypes.h"
|
#include "ssetypes.h"
|
||||||
|
|
||||||
#include "transform2.h"
|
#include "transform2.h"
|
||||||
#include "base/constants.h"
|
#include "constants.h"
|
||||||
|
|
||||||
namespace base2
|
namespace base2
|
||||||
{
|
{
|
||||||
|
|||||||
20
test_double_precision.cpp
Normal file
20
test_double_precision.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
int main ( void )
|
||||||
|
{
|
||||||
|
volatile double d = 0.00000001;
|
||||||
|
volatile double a = 90;
|
||||||
|
volatile double b = a + d;
|
||||||
|
volatile double c = b - a;
|
||||||
|
|
||||||
|
std::cout << std::setprecision(15) << "a = " << a << std::endl;
|
||||||
|
std::cout << std::setprecision(15) << "b = " << b << std::endl;
|
||||||
|
std::cout << std::setprecision(15) << "c = " << c << std::endl;
|
||||||
|
std::cout << std::setprecision(15) << "d = " << d << std::endl;
|
||||||
|
std::cout << "b == d -> " << (b == d) << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
10
test_empty_struct.cpp
Normal file
10
test_empty_struct.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class A
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
int main( )
|
||||||
|
{
|
||||||
|
A* p = new A;
|
||||||
|
p->operator delete();
|
||||||
|
}
|
||||||
|
|
||||||
126
test_i32_overflow.cpp
Normal file
126
test_i32_overflow.cpp
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
#include <exception>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
inline void throw_overflow ()
|
||||||
|
{
|
||||||
|
throw std::runtime_error( "Overflow!!!" );
|
||||||
|
}
|
||||||
|
|
||||||
|
#define E void (*err)()
|
||||||
|
|
||||||
|
//template <class E>
|
||||||
|
inline int add( int op1, int op2, E )
|
||||||
|
{
|
||||||
|
asm ( "add %1, %0"
|
||||||
|
: "=r"(op1)
|
||||||
|
: "r"(op2),"0"(op1) );
|
||||||
|
asm goto( "jo %l[throw_exception]"
|
||||||
|
: : : "memory"
|
||||||
|
: throw_exception );
|
||||||
|
return op1;
|
||||||
|
|
||||||
|
throw_exception:
|
||||||
|
err();
|
||||||
|
}
|
||||||
|
|
||||||
|
//template <class E>
|
||||||
|
inline long add( long op1, long op2, E)
|
||||||
|
{
|
||||||
|
asm ( "add %1, %0"
|
||||||
|
: "=r"(op1)
|
||||||
|
: "r"(op2),"0"(op1) );
|
||||||
|
asm goto( "jo %l[throw_exception]"
|
||||||
|
: : : "memory"
|
||||||
|
: throw_exception );
|
||||||
|
return op1;
|
||||||
|
|
||||||
|
throw_exception:
|
||||||
|
err();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Just test a possible implementation for 386
|
||||||
|
//template <class E>
|
||||||
|
inline long long add( long long op1, long long op2, E )
|
||||||
|
{
|
||||||
|
unsigned int op1l = (unsigned int)op1;
|
||||||
|
unsigned int op1h = (unsigned int)((unsigned long long)op1 >> 32);
|
||||||
|
unsigned int op2l = (unsigned int)op2;
|
||||||
|
unsigned int op2h = (unsigned int)((unsigned long long)op2 >> 32);
|
||||||
|
asm ( "add %2, %0\n"
|
||||||
|
"adc %3, %1"
|
||||||
|
: "=a"(op1l),"=d"(op1h)
|
||||||
|
: "g"(op2l),"g"(op2h),"0"(op1l),"1"(op1h) );
|
||||||
|
asm goto( "jo %l[throw_exception]"
|
||||||
|
: : : "memory"
|
||||||
|
: throw_exception );
|
||||||
|
return (long long)((unsigned long long)op1l | ((unsigned long long)op1h << 32));
|
||||||
|
|
||||||
|
throw_exception:
|
||||||
|
err();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
//
|
||||||
|
//GCC 4.5.2 crashes on this template.
|
||||||
|
//I filed a bug against GCC. #55528
|
||||||
|
//
|
||||||
|
template <class C>
|
||||||
|
inline C add2( C op1, C op2 )
|
||||||
|
{
|
||||||
|
asm ( "add %1, %0"
|
||||||
|
: "=r"(op1)
|
||||||
|
: "r"(op2),"0"(op1) );
|
||||||
|
asm goto( "jo %l[throw_exception]"
|
||||||
|
: : : "memory"
|
||||||
|
: throw_exception );
|
||||||
|
return op1;
|
||||||
|
|
||||||
|
throw_exception:
|
||||||
|
return throw_overflow();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <class C>
|
||||||
|
inline void test_add( C op1, C op2 )
|
||||||
|
{try
|
||||||
|
{
|
||||||
|
std::cout << op1 << " + " << op2 << " = ";
|
||||||
|
std::cout.flush();
|
||||||
|
C r = add( op1, op2, &throw_overflow );
|
||||||
|
std::cout << r << std::endl;
|
||||||
|
}
|
||||||
|
catch ( const std::exception& e )
|
||||||
|
{
|
||||||
|
std::cout << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
catch ( ... )
|
||||||
|
{
|
||||||
|
std::cout << "unknown exception" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
test_add( 10, 20);
|
||||||
|
test_add( 100, 200);
|
||||||
|
test_add( 1000, 2000);
|
||||||
|
test_add( 1000000000, 2000000000);
|
||||||
|
test_add( 1000000000, -2000000000);
|
||||||
|
test_add( -1000000000, 2000000000);
|
||||||
|
test_add( -1000000000, -2000000000);
|
||||||
|
test_add( 1000000000L, 2000000000L);
|
||||||
|
test_add( 1000000000L,-2000000000L);
|
||||||
|
test_add( -1000000000L, 2000000000L);
|
||||||
|
test_add( -1000000000L,-2000000000L);
|
||||||
|
test_add( 7000000000000000000L, 8000000000000000000L);
|
||||||
|
test_add( 7000000000000000000L, -8000000000000000000L);
|
||||||
|
test_add( -7000000000000000000L, 8000000000000000000L);
|
||||||
|
test_add( -7000000000000000000L, -8000000000000000000L);
|
||||||
|
test_add( (long long)7000000000000000000L, (long long)8000000000000000000L);
|
||||||
|
test_add( (long long)7000000000000000000L, (long long)-8000000000000000000L);
|
||||||
|
test_add( (long long)-7000000000000000000L, (long long)8000000000000000000L);
|
||||||
|
test_add( (long long)-7000000000000000000L, (long long)-8000000000000000000L);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
39
test_namespace_rename.cpp
Normal file
39
test_namespace_rename.cpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
//#include <wchar_tiostream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
namespace tr1
|
||||||
|
{
|
||||||
|
template <class Ch>
|
||||||
|
class A
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
std::cout << "I am std::tr1::A<Ch>::f()" << std::endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void A<wchar_t>::f()
|
||||||
|
{
|
||||||
|
std::wcout << L"I am std::tr1::A<wchar_t>::f()" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
using std::tr1::A;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
std::A<wchar_t> a;
|
||||||
|
a.f();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user