initial check in

This commit is contained in:
2012-12-06 21:43:03 +04:00
commit 4bc273824d
179 changed files with 29415 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
*.o
*.obj
*.cpp~
*.h~

47
Duffs_device.cpp Normal file
View File

@@ -0,0 +1,47 @@
#include <stdlib.h>
#include <iostream>
void send(short *to, const short *from, size_t count)
{
size_t n=(count+7)/8;
switch(count%8){
case 0: do{ *to += *from++;
case 7: *to += *from++;
case 6: *to += *from++;
case 5: *to += *from++;
case 4: *to += *from++;
case 3: *to += *from++;
case 2: *to += *from++;
case 1: *to += *from++;
}while(--n>0);
}
}
void send2(short *to, const short *from, size_t count)
{
int n=(count+7)/8;
switch(count%8){
case 0: while(--n>0){
*to += *from++;
case 7: *to += *from++;
case 6: *to += *from++;
case 5: *to += *from++;
case 4: *to += *from++;
case 3: *to += *from++;
case 2: *to += *from++;
case 1: *to += *from++;
}
}
}
int main ( )
{
short a[256];
short sum = 0;
for ( int i = 0; i < sizeof(a)/sizeof(a[0]); ++i )
a[i] = 1;
send2( &sum, a, 0 );
std::cout << sum << std::endl;
return 0;
}

204
OpenMPForVC2k5/omp.h Normal file
View File

@@ -0,0 +1,204 @@
//-----------------------------------------------------------------------------
// OpenMP runtime support library for Visual C++
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
// OpenMP C/C++ Version 2.0 March 2002
#pragma once
#if defined(__cplusplus)
extern "C" {
#endif
#define _OMPAPI __cdecl
#if !defined(_OMP_LOCK_T)
#define _OMP_LOCK_T
typedef void * omp_lock_t;
#endif
#if !defined(_OMP_NEST_LOCK_T)
#define _OMP_NEST_LOCK_T
typedef void * omp_nest_lock_t;
#endif
#if !defined(_OPENMP)
#if defined(_DEBUG)
#pragma comment(lib, "vcompd")
#else // _DEBUG
#pragma comment(lib, "vcomp")
#endif // _DEBUG
#endif // _OPENMP
#if !defined(_OPENMP_NOFORCE_MANIFEST)
#include <crtassem.h>
#if defined(_DEBUG)
#if defined(_M_IX86)
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugOpenMP' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='x86' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#elif defined(_M_AMD64)
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugOpenMP' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='amd64' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#elif defined(_M_IA64)
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugOpenMP' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='ia64' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#endif
#else // _DEBUG
#if defined(_M_IX86)
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".OpenMP' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='x86' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#elif defined(_M_AMD64)
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".OpenMP' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='amd64' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#elif defined(_M_IA64)
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".OpenMP' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='ia64' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#endif
#endif // _DEBUG
#endif // _OPENMP_NOFORCE_MANIFEST
#if !defined(_OMPIMP)
#define _OMPIMP __declspec(dllimport)
#endif
_OMPIMP void _OMPAPI
omp_set_num_threads(
int _Num_threads
);
_OMPIMP int _OMPAPI
omp_get_num_threads(
void
);
_OMPIMP int _OMPAPI
omp_get_max_threads(
void
);
_OMPIMP int _OMPAPI
omp_get_thread_num(
void
);
_OMPIMP int _OMPAPI
omp_get_num_procs(
void
);
_OMPIMP void _OMPAPI
omp_set_dynamic(
int _Dynamic_threads
);
_OMPIMP int _OMPAPI
omp_get_dynamic(
void
);
_OMPIMP int _OMPAPI
omp_in_parallel(
void
);
_OMPIMP void _OMPAPI
omp_set_nested(
int _Nested
);
_OMPIMP int _OMPAPI
omp_get_nested(
void
);
_OMPIMP void _OMPAPI
omp_init_lock(
omp_lock_t * _Lock
);
_OMPIMP void _OMPAPI
omp_destroy_lock(
omp_lock_t * _Lock
);
_OMPIMP void _OMPAPI
omp_set_lock(
omp_lock_t * _Lock
);
_OMPIMP void _OMPAPI
omp_unset_lock(
omp_lock_t * _Lock
);
_OMPIMP int _OMPAPI
omp_test_lock(
omp_lock_t * _Lock
);
_OMPIMP void _OMPAPI
omp_init_nest_lock(
omp_nest_lock_t * _Lock
);
_OMPIMP void _OMPAPI
omp_destroy_nest_lock(
omp_nest_lock_t * _Lock
);
_OMPIMP void _OMPAPI
omp_set_nest_lock(
omp_nest_lock_t * _Lock
);
_OMPIMP void _OMPAPI
omp_unset_nest_lock(
omp_nest_lock_t * _Lock
);
_OMPIMP int _OMPAPI
omp_test_nest_lock(
omp_nest_lock_t * _Lock
);
_OMPIMP double _OMPAPI
omp_get_wtime(
void
);
_OMPIMP double _OMPAPI
omp_get_wtick(
void
);
#if defined(__cplusplus)
}
#endif

1562
SSE2_transform.cpp Normal file

File diff suppressed because it is too large Load Diff

1119
SSE2_transform.h Normal file

File diff suppressed because it is too large Load Diff

280
SSE_cmplr_abstraction.h Normal file
View File

@@ -0,0 +1,280 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_H_
#define _SSE2_CMPL_ABSTRACTION_H_
#include <boost/static_assert.hpp>
#include <boost/type_traits.hpp>
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
// Ms Visual Studio
//
#if defined( _MSC_VER ) && _MSC_VER
#include "SSE_cmplr_abstraction_MSC.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
// the GCC
//
#elif defined( _gcc )
#include "SSE_cmplr_abstraction_GCC.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
// Other
//
#else
#include "SSE_cmplr_abstraction_other.h"
#endif
//
// Namespace sse2
//
namespace sse2
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// the wrapper for 128 bit xmm registers.
//
template <class X, class T, int N = (16/sizeof(T)) >
class xmm128
{
// Type
protected:
//
/// The XMM register type.
//
typedef X MY_XMM;
//
/// The XMM register type.
//
typedef T MY_TYPE;
// Data
protected:
//
/// The union of
//
union
{
MY_XMM x;
MY_TYPE n[N];
};
// Construction
public:
//
/// The default constructor.
//
xmm128()
{
//
// We must be 128 bits only.
//
BOOST_STATIC_ASSERT( 16/sizeof( MY_TYPE ) == N );
}
//
/// The copy constructor.
//
xmm128( const xmm128& op )
{
//
// We must be 128 bits only.
//
BOOST_STATIC_ASSERT( 16/sizeof( MY_TYPE ) == N );
//
// Just assign.
//
x = op.x;
}
//
/// The copy constructor.
//
xmm128( const MY_XMM& op )
{
//
// We must be 128 bits only.
//
BOOST_STATIC_ASSERT( 16/sizeof( MY_TYPE ) == N );
//
// Just assign.
//
x = op.x;
x = op;
}
//
/// The destructor.
//
~xmm128()
{}
// Interface
public:
//
/// Assign our kind.
//
xmm128& operator= ( const xmm128& op )
{
x = op.x;
return *this;
}
//
/// Assign the xmm type.
//
xmm128& operator= ( const MY_XMM& op )
{
x = op;
return *this;
}
//
/// Operator to get packed type. The const version.
//
operator MY_XMM () const
{
return x;
}
//
/// Operator to get packed type reference. Can be used as a lvalue.
//
MY_TYPE& operator[] ( int idx )
{
assert( 0<= idx && idx < N );
return n[idx];
}
//
/// Operator to get packed type. The const version.
//
MY_TYPE operator[] ( int idx ) const
{
assert( 0<= idx && idx < N );
return n[idx];
}
//
/// Set from two values.
//
void set( MY_TYPE v1, MY_TYPE v2 )
{
BOOST_STATIC_ASSERT( 16 / sizeof( MY_TYPE ) == 2 );
operator[0] = v1;
operator[1] = v2;
}
//
/// Set from two values.
//
void set( MY_TYPE v1, MY_TYPE v2, MY_TYPE v2, MY_TYPE v4 )
{
BOOST_STATIC_ASSERT( 16 / sizeof( MY_TYPE ) == 4 );
operator[0] = v1;
operator[1] = v2;
operator[2] = v3;
operator[3] = v4;
}
add
sub
andnot
and
or
xor
sqrt
mul
div
min
max
shift
comp
};
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
class xmm128d : public xmm128 < rxmm128d, double, 2 >
{
// Construction
public:
//
/// The default constructor.
//
xmm128d()
{}
//
/// The copy constructor.
//
xmm128d( const xmm128d& op )
: xmm128( op )
{}
//
/// The copy constructor.
//
xmm128d( const MY_XMM& op )
: xmm128( op )
{}
//
/// The copy constructor.
//
xmm128d( double d1, double d2 )
{
set( d1, d2 );
}
// Interface
public:
//
/// Set from two doubles.
//
void set( double d1, double d2 )
{
operator[0] = d1;
operator[1] = d2;
}
};
*/
//
// Namespace sse2
//
}
#endif/*_SSE2_CMPL_ABSTRACTION_H_*/

View File

@@ -0,0 +1,60 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_GCC_H_
#define _SSE2_CMPL_ABSTRACTION_GCC_H_
#include <boost/static_assert.hpp>
//
// Namespace sse2
//
namespace sse2
{
//
// Primitive types
//
/// 2xdouble
//
typedef int xmm128d __attribute__ ((mode(V2DF)));
/// 4xfloat
//
typedef int xmm128s __attribute__ ((mode(V4SF)));
/// 2xint64
//
typedef int xmm128l __attribute__ ((mode(V4SF)));
/// 4xint32
//
typedef int xmm128i __attribute__ ((mode(V4SF)));
/// int64
//
typedef long int;
//
// Namespace sse2
//
}
#include "SSE_cmplr_abstraction_GCC_pckdbl.h"
#include "SSE_cmplr_abstraction_GCC_pckfloat.h"
#include "SSE_cmplr_abstraction_GCC_pckint8.h"
#include "SSE_cmplr_abstraction_GCC_pckint16.h"
#include "SSE_cmplr_abstraction_GCC_pckint32.h"
#include "SSE_cmplr_abstraction_GCC_pckint64.h"
#endif/*_SSE2_CMPL_ABSTRACTION_GCC_H_*/

View File

@@ -0,0 +1,61 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_MSC_H_
#define _SSE2_CMPL_ABSTRACTION_MSC_H_
#include <boost/static_assert.hpp>
#include <emmintrin.h>
//
// Namespace sse2
//
namespace sse2
{
//
// Primitive types
//
/// 2xdouble
//
typedef __m128d rxmm128d;
/// 4xfloat
//
typedef __m128 rxmm128s;
/// 2xint64
//
typedef __m128i rxmm128l;
/// 4xint32
//
typedef __m128 rxmm128i;
/// int64
//
typedef __int64 int64;
//
// Namespace sse2
//
}
#include "SSE_cmplr_abstraction_MSC_pckdbl.h"
#include "SSE_cmplr_abstraction_MSC_pckfloat.h"
#include "SSE_cmplr_abstraction_MSC_pckint8.h"
#include "SSE_cmplr_abstraction_MSC_pckint16.h"
#include "SSE_cmplr_abstraction_MSC_pckint32.h"
#include "SSE_cmplr_abstraction_MSC_pckint64.h"
#endif/*_SSE2_CMPL_ABSTRACTION_MSC_H_*/

View File

@@ -0,0 +1,895 @@
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_MSC_H_
#define _SSE2_CMPL_ABSTRACTION_MSC_H_
#include <emmintrin.h>
#include <dvec.h>
//
// Namespace sse2
//
namespace sse2
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
// Primitive types
//
/// 2xdouble
//
typedef __m128d rxmm128d;
/// 4xfloat
//
typedef __m128 rxmm128s;
/// 2xint64
//
typedef __m128i rxmm128l;
/// 4xint32
//
typedef __m128 rxmm128i;
/// int64
//
typedef __int64 int64;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double arithmetic
//
class arithmetic_pd
{
public:
/*!
r0 := a0 + b0
r1 := a1 + b1
*/
static inline rxmm128d add( rxmm128d a, rxmm128d b )
{
return _mm_add_pd( a, b );
}
/*!
r0 := a0 - b0
r1 := a1 - b1
*/
static inline rxmm128d sub( rxmm128d a, rxmm128d b )
{
return _mm_sub_pd( a, b );
}
/*!
r0 := a0 * b0
r1 := a1 * b1
*/
static inline rxmm128d mul( rxmm128d a, rxmm128d b )
{
return _mm_mul_pd( a, b );
}
/*!
r0 := a0 / b0
r1 := a1 / b1
*/
static inline rxmm128d div( rxmm128d a, rxmm128d b )
{
return _mm_div_pd( a, b );
}
/*!
r0 := max( a0, b0 )
r1 := max( a1, b1 )
*/
static inline rxmm128d max( rxmm128d a, rxmm128d b )
{
return _mm_max_pd( a, b );
}
/*!
r0 := min( a0, b0 )
r1 := min( a1, b1 )
*/
static inline rxmm128d min( rxmm128d a, rxmm128d b )
{
return _mm_min_pd( a, b );
}
/*!
r0 := sqrt( a0 )
r1 := sqrt( a1 )
*/
static inline rxmm128d sqrt( rxmm128d a )
{
return _mm_sqrt_pd( a, b );
}
};
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double logic
//
class logic_pd
{
public:
/*!
r0 := (~a0) & b0
r1 := (~a1) & b1
*/
static inline rxmm128d andnot( rxmm128d a, rxmm128d b )
{
return _mm_andnot_pd( a, b );
}
/*!
r0 := a0 & b0
r1 := a1 & b1
*/
static inline XMM_TYPE and( rxmm128d a, rxmm128d b )
{
return _mm_and_pd( a, b );
}
/*!
r0 := a0 | b0
r1 := a1 | b1
*/
static inline XMM_TYPE or( rxmm128d a, rxmm128d b )
{
return _mm_or_pd( a, b );
}
/*!
r0 := a0 ^ b0
r1 := a1 ^ b1
*/
static inline XMM_TYPE xor( rxmm128d a, rxmm128d b )
{
return _mm_xor_pd( a, b );
}
};
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double comparision
//
class comparision_pd
{
public:
/*!
r0 := (a0 == b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 == b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_eq( rxmm128d a, rxmm128d b )
{
return _mm_cmpeq_pd( a, b );
}
/*!
r0 := (a0 != b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 != b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_neq( rxmm128d a, rxmm128d b )
{
return _mm_cmpneq_pd( a, b );
}
/*!
r0 := (a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 < b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_lt( rxmm128d a, rxmm128d b )
{
return _mm_cmplt_pd( a, b );
}
/*!
r0 := (a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 <= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_le( rxmm128d a, rxmm128d b )
{
return _mm_cmple_pd( a, b );
}
/*!
r0 := (a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 > b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_gt( rxmm128d a, rxmm128d b )
{
return _mm_cmpgt_pd( a, b );
}
/*!
r0 := (a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 >= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ge( rxmm128d a, rxmm128d b )
{
return _mm_cmpge_pd( a, b );
}
/*!
r0 := (a0 ord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 ord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ord( rxmm128d a, rxmm128d b )
{
return _mm_cmpord_pd( a, b );
}
/*!
r0 := (a0 unord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 unord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_unord( rxmm128d a, rxmm128d b )
{
return _mm_cmpunord_pd( a, b );
}
};
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double logic
//
class logic_pd
{
public:
};
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double logic
//
class logic_pd
{
public:
};
/// Abstract
//
class func_d64x2
{
public:
typedef XMM_TYPE rxmm128d;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Arithmetic PD
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Arithmetic SD
/*!
r0 := a0 + b0
r1 := a1
*/
static inline XMM_TYPE addsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_add_sd( a, b );
}
/*!
r0 := a0 - b0
r1 := a1
*/
static inline XMM_TYPE subsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_sub_sd( a, b );
}
/*!
r0 := a0 * b0
r1 := a1
*/
static inline XMM_TYPE mulsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_mul_sd( a, b );
}
/*!
r0 := a0 / b0
r1 := a1
*/
static inline XMM_TYPE divsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_div_sd( a, b );
}
/*!
r0 := max( a0, b0 )
r1 := a1
*/
static inline XMM_TYPE maxsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_max_sd( a, b );
}
/*!
r0 := min( a0, b0 )
r1 := a1
*/
static inline XMM_TYPE minsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_min_sd( a, b );
}
/*!
r0 := sqrt( b0 )
r1 := a1
*/
static inline XMM_TYPE sqrtsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_sqrt_sd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Logic PD
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Comparision PD
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Comparision SD
/*!
r0 := (a0 == b0) ? 0xffffffffffffffff : 0x0
r1 := a1
*/
static inline XMM_TYPE cmpeqsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_cmpeq_sd( a, b );
}
/*!
r0 := (a0 != b0) ? 0xffffffffffffffff : 0x0
r1 := a1
*/
static inline XMM_TYPE cmpneqsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_cmpneq_sd( a, b );
}
/*!
r0 := (a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := a1
*/
static inline XMM_TYPE cmpltsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_cmplt_sd( a, b );
}
/*!
r0 := (a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := a1
*/
static inline XMM_TYPE cmplesd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_cmple_sd( a, b );
}
/*!
r0 := (a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := a1
*/
static inline XMM_TYPE cmpgtsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_cmpgt_sd( a, b );
}
/*!
r0 := (a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := a1
*/
static inline XMM_TYPE cmpgesd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_cmpge_sd( a, b );
}
/*!
r0 := (a0 ord b0) ? 0xffffffffffffffff : 0x0
r1 := a1
*/
static inline XMM_TYPE cmpordsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_cmpord_sd( a, b );
}
/*!
r0 := (a0 unord b0) ? 0xffffffffffffffff : 0x0
r1 := a1
*/
static inline XMM_TYPE cmpunordsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_cmpunord_sd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Comparision SD
/*!
r := (a0 == b0) ? 0x1 : 0x0
*/
static inline int comieqsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_comieq_sd( a, b );
}
/*!
r := (a0 != b0) ? 0x1 : 0x0
*/
static inline int comineqsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_comineq_sd( a, b );
}
/*!
r := (a0 < b0) ? 0x1 : 0x0
*/
static inline int comiltsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_comilt_sd( a, b );
}
/*!
r := (a0 <= b0) ? 0x1 : 0x0
*/
static inline int comilesd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_comile_sd( a, b );
}
/*!
r := (a0 > b0) ? 0x1 : 0x0
*/
static inline int comigtsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_comigt_sd( a, b );
}
/*!
r := (a0 >= b0) ? 0x1 : 0x0
*/
static inline int comigesd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_comige_sd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Comparision SD
/*!
r := (a0 == b0) ? 0x1 : 0x0
*/
static inline int ucomieqsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_ucomieq_sd( a, b );
}
/*!
r := (a0 != b0) ? 0x1 : 0x0
*/
static inline int ucomineqsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_ucomineq_sd( a, b );
}
/*!
r := (a0 < b0) ? 0x1 : 0x0
*/
static inline int ucomiltsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_ucomilt_sd( a, b );
}
/*!
r := (a0 <= b0) ? 0x1 : 0x0
*/
static inline int ucomilesd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_ucomile_sd( a, b );
}
/*!
r := (a0 > b0) ? 0x1 : 0x0
*/
static inline int ucomigtsd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_ucomigt_sd( a, b );
}
/*!
r := (a0 >= b0) ? 0x1 : 0x0
*/
static inline int ucomigesd( XMM_TYPE a, XMM_TYPE b )
{
return _mm_ucomige_sd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Conversion
/*!
r0 := (float) a0
r1 := (float) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128s cvtpd2ps( rxmm128d a )
{
return _mm_cvtpd_ps( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtps2pd( rxmm128s a )
{
return _mm_cvtps_pd( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l cvtpd2dq( rxmm128d a )
{
return _mm_cvtpd_epi32( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtdq2pd( rxmm128l a )
{
return _mm_cvtepi32_pd( a );
}
/*!
r := (int) a0
*/
static inline int cvtsd2si( rxmm128d a )
{
return _mm_cvtsd_si32( a );
}
/*!
r0 := (float) b0
r1 := a1
r2 := a2
r3 := a3
*/
static inline rxmm128s cvtsd2ss( rxmm128l a, rxmm128d b )
{
return _mm_cvtsd_ss( a, b );
}
/*!
r0 := (double) b
r1 := a1
*/
static inline rxmm128d cvtsi2sd( rxmm128d a, int b )
{
return _mm_cvtsi32_sd( a, b );
}
/*!
r0 := (double) b0
r1 := a1
*/
static inline rxmm128d cvtss2sd( rxmm128d a, rxmm128s b )
{
return _mm_cvtss_sd( a, b );
}
/*!
using truncate
r0 := (int) a0
r1 := (int) a1
r2 := 0x0
r3 := 0x0
*/
static inline rxmm128l cvttpd2dq( rxmm128d a )
{
return _mm_cvttpd_epi32( a );
}
/*!
using truncate
r := (int) a0
*/
static inline int cvttsd2si( rxmm128d a )
{
return _mm_cvttsd_si32( a );
}
/*!
r0 := (float) a0
r1 := (float) a1
r2 := (float) a2
r3 := (float) a3
*/
static inline rxmm128s cvtdq2ps( rxmm128l a )
{
return _mm_cvtepi32_ps( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvtps2dq( rxmm128s a )
{
return _mm_cvtps_epi32( a );
}
/*!
uses trancate
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvttps2dq( rxmm128s a )
{
return _mm_cvttps_epi32( a );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Misc
/*!
r0 := a1
r1 := b1
*/
static inline rxmm128d unpckhpd( rxmm128d a, rxmm128d b )
{
return _mm_unpackhi_pd( a, b );
}
/*!
r0 := a0
r1 := b0
*/
static inline rxmm128d unpcklpd( rxmm128d a, rxmm128d b )
{
return _mm_unpacklo_pd( a, b );
}
/*!
r := sign(a1) << 1 | sign(a0)
*/
static inline int movmskpd( rxmm128d a, rxmm128d b )
{
return _mm_movemask_pd( a, b );
}
/*!
r0 := (i0 == 1) ? b0 : a0
r1 := (i1 == 1) ? b1 : a1
*/
static inline int shuffle_pd( rxmm128d a, rxmm128d b, int i )
{
return _mm_shuffle_pd( a, b, i );
}
/*!
== shuffle_pd( a, b, 1 )
r0 := b0
r1 := a1
*/
static inline rxmm128d move_sd( rxmm128d a, rxmm128d b )
{
return _mm_move_sd( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory load
/*!
The address \arg p must be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load_pd( double * p )
{
return _mm_load_pd( p );
}
/*!
The address \arg p must be 16-byte aligned.
r0 := p[1]
r1 := p[0]
*/
static inline rxmm128d load_pd_reverse( double * p )
{
return _mm_loadr_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load_pd_unaligned( double * p )
{
return _mm_loadu_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := *p
*/
static inline rxmm128d load_pd_hi( rxmm128d a, double * p )
{
return _mm_loadh_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := a1
*/
static inline rxmm128d load_pd_lo( rxmm128d a, double * p )
{
return _mm_loadl_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := *p
*/
static inline rxmm128d load_pd_both( double * p )
{
return _mm_load1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := 0.0
*/
static inline rxmm128d load_sd( double * p )
{
return _mm_load_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory store
/*!
The address \arg p must be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store_pd( double * p, rxmm128d a )
{
_mm_load_pd( p, a );
}
/*!
The address \arg p must be 16-byte aligned.
p[0] := a1
p[1] := a0
*/
static inline void store_pd_reverse( double * p, rxmm128d a )
{
_mm_storer_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store_pd_unaligned(double * p, rxmm128d a )
{
_mm_storeu_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a1
*/
static inline void store_pd_hi( double * p, rxmm128d a )
{
_mm_storeh_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_pd_lo( double * p, rxmm128d a )
{
_mm_storel_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a0
*/
static inline void store_pd_both( double * p, rxmm128d a )
{
return _mm_store1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_sd( double * p, rxmm128d a )
{
return _mm_store_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory set
/*!
r0 := a0
r1 := a1
*/
static inline rxmm128d set_pd( double a1, double a0 )
{
return _mm_set_pd( a1, a0 );
}
/*!
r0 := 0.0
r1 := 0.0
*/
static inline rxmm128d set_pd_zero()
{
return _mm_setzero_pd( a0 );
}
/*!
r0 := a0
r1 := a0
*/
static inline rxmm128d set_pd_both( double a0)
{
return _mm_set1_pd( a0 );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := 0.0
*/
static inline rxmm128d set_sd( double a0 )
{
return _mm_set_sd( a0 );
}
};
//
// Namespace sse2
//
}
#endif/*_SSE2_CMPL_ABSTRACTION_MSC_H_*/

View File

@@ -0,0 +1,624 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_MSC_PCKDBL_H_
#define _SSE2_CMPL_ABSTRACTION_MSC_PCKDBL_H_
//
// Namespace sse2
//
namespace sse2
{
//
/// class pd (packed double)
//
class pd
{
public:
//
/// The type.
//
typedef rxmm128d my_rxmm;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double arithmetic
//
/*!
r0 := a0 + b0
r1 := a1 + b1
*/
static inline rxmm128d add( rxmm128d a, rxmm128d b )
{
return _mm_add_pd( a, b );
}
/*!
r0 := a0 - b0
r1 := a1 - b1
*/
static inline rxmm128d sub( rxmm128d a, rxmm128d b )
{
return _mm_sub_pd( a, b );
}
/*!
r0 := a0 * b0
r1 := a1 * b1
*/
static inline rxmm128d mul( rxmm128d a, rxmm128d b )
{
return _mm_mul_pd( a, b );
}
/*!
r0 := a0 / b0
r1 := a1 / b1
*/
static inline rxmm128d div( rxmm128d a, rxmm128d b )
{
return _mm_div_pd( a, b );
}
/*!
r0 := max( a0, b0 )
r1 := max( a1, b1 )
*/
static inline rxmm128d max( rxmm128d a, rxmm128d b )
{
return _mm_max_pd( a, b );
}
/*!
r0 := min( a0, b0 )
r1 := min( a1, b1 )
*/
static inline rxmm128d min( rxmm128d a, rxmm128d b )
{
return _mm_min_pd( a, b );
}
/*!
r0 := sqrt( a0 )
r1 := sqrt( a1 )
*/
static inline rxmm128d sqrt( rxmm128d a )
{
return _mm_sqrt_pd( a );
}
/*!
r0 := recip(a0)
r1 := recip(a1)
*/
static inline rxmm128d rcp( rxmm128d a )
{
rxmm128d t = _mm_set1_pd( 1.0 );
return _mm_div_pd( t, a );
}
/*!
r0 := recip(sqrt(a0))
r1 := recip(sqrt(a1))
*/
static inline rxmm128d rsqrt( rxmm128d a )
{
rxmm128d t = _mm_set1_pd( 1.0 );
rxmm128d u = _mm_sqrt_pd( a );
return _mm_div_pd( t, u );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double logic
//
/*!
r0 := (~a0) & b0
r1 := (~a1) & b1
*/
static inline rxmm128d andnot( rxmm128d a, rxmm128d b )
{
return _mm_andnot_pd( a, b );
}
/*!
r0 := a0 & b0
r1 := a1 & b1
*/
static inline XMM_TYPE and( rxmm128d a, rxmm128d b )
{
return _mm_and_pd( a, b );
}
/*!
r0 := a0 | b0
r1 := a1 | b1
*/
static inline XMM_TYPE or( rxmm128d a, rxmm128d b )
{
return _mm_or_pd( a, b );
}
/*!
r0 := a0 ^ b0
r1 := a1 ^ b1
*/
static inline XMM_TYPE xor( rxmm128d a, rxmm128d b )
{
return _mm_xor_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double comparision
//
/*!
r0 := (a0 == b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 == b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_eq( rxmm128d a, rxmm128d b )
{
return _mm_cmpeq_pd( a, b );
}
/*!
r0 := (a0 != b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 != b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_neq( rxmm128d a, rxmm128d b )
{
return _mm_cmpneq_pd( a, b );
}
/*!
r0 := (a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 < b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_lt( rxmm128d a, rxmm128d b )
{
return _mm_cmplt_pd( a, b );
}
/*!
r0 := (a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 <= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_le( rxmm128d a, rxmm128d b )
{
return _mm_cmple_pd( a, b );
}
/*!
r0 := (a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 > b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_gt( rxmm128d a, rxmm128d b )
{
return _mm_cmpgt_pd( a, b );
}
/*!
r0 := (a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 >= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ge( rxmm128d a, rxmm128d b )
{
return _mm_cmpge_pd( a, b );
}
/*!
r0 := (a0 ord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 ord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ord( rxmm128d a, rxmm128d b )
{
return _mm_cmpord_pd( a, b );
}
/*!
r0 := (a0 unord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 unord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_unord( rxmm128d a, rxmm128d b )
{
return _mm_cmpunord_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double load
//
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Misc
/*!
r0 := a1
r1 := b1
*/
static inline rxmm128d unpckh( rxmm128d a, rxmm128d b )
{
return _mm_unpackhi_pd( a, b );
}
/*!
r0 := a0
r1 := b0
*/
static inline rxmm128d unpckl( rxmm128d a, rxmm128d b )
{
return _mm_unpacklo_pd( a, b );
}
/*!
r := sign(a1) << 1 | sign(a0)
*/
static inline int movmsk( rxmm128d a, rxmm128d b )
{
return _mm_movemask_pd( a, b );
}
/*!
r0 := (i0 == 1) ? b0 : a0
r1 := (i1 == 1) ? b1 : a1
\sa movmsk
*/
static inline int shuffle( rxmm128d a, rxmm128d b, int i )
{
return _mm_shuffle_pd( a, b, i );
}
/*!
== shuffle( a, b, 1 )
r0 := b0
r1 := a1
*/
static inline rxmm128d move_sd( rxmm128d a, rxmm128d b )
{
return _mm_move_sd( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory load
/*!
The address \arg p must be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load( double * p )
{
return _mm_load_pd( p );
}
/*!
The address \arg p must be 16-byte aligned.
r0 := p[1]
r1 := p[0]
*/
static inline rxmm128d load_reverse( double * p )
{
return _mm_loadr_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load_unaligned( double * p )
{
return _mm_loadu_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := *p
*/
static inline rxmm128d load_hi( rxmm128d a, double * p )
{
return _mm_loadh_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := a1
*/
static inline rxmm128d load_lo( rxmm128d a, double * p )
{
return _mm_loadl_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := *p
*/
static inline rxmm128d load_both( double * p )
{
return _mm_load1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := 0.0
*/
static inline rxmm128d load_s( double * p )
{
return _mm_load_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory store
/*!
The address \arg p must be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store( double * p, rxmm128d a )
{
_mm_store_pd( p, a );
}
/*!
The address \arg p must be 16-byte aligned.
p[0] := a1
p[1] := a0
*/
static inline void store_reverse( double * p, rxmm128d a )
{
_mm_storer_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store_unaligned(double * p, rxmm128d a )
{
_mm_storeu_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a1
*/
static inline void store_hi( double * p, rxmm128d a )
{
_mm_storeh_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_lo( double * p, rxmm128d a )
{
_mm_storel_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a0
*/
static inline void store_both( double * p, rxmm128d a )
{
return _mm_store1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_s( double * p, rxmm128d a )
{
return _mm_store_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory set
/*!
r0 := a0
r1 := a1
*/
static inline rxmm128d set( double a1, double a0 )
{
return _mm_set_pd( a1, a0 );
}
/*!
r0 := 0.0
r1 := 0.0
*/
static inline rxmm128d set_zero()
{
return _mm_setzero_pd( a0 );
}
/*!
r0 := a0
r1 := a0
*/
static inline rxmm128d set_both( double a0 )
{
return _mm_set1_pd( a0 );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := 0.0
*/
static inline rxmm128d set_s( double a0 )
{
return _mm_set_sd( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double convertion
//
/*!
r0 := (float) a0
r1 := (float) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128s cvtpd2ps( rxmm128d a )
{
return _mm_cvtpd_ps( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtps2pd( rxmm128s a )
{
return _mm_cvtps_pd( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l cvtpd2dq( rxmm128d a )
{
return _mm_cvtpd_epi32( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtdq2pd( rxmm128l a )
{
return _mm_cvtepi32_pd( a );
}
/*!
r := (int) a0
*/
static inline int cvtsd2si( rxmm128d a )
{
return _mm_cvtsd_si32( a );
}
/*!
r0 := (float) b0
r1 := a1
r2 := a2
r3 := a3
*/
static inline rxmm128s cvtsd2ss( rxmm128l a, rxmm128d b )
{
return _mm_cvtsd_ss( a, b );
}
/*!
r0 := (double) b
r1 := a1
*/
static inline rxmm128d cvtsi2sd( rxmm128d a, int b )
{
return _mm_cvtsi32_sd( a, b );
}
/*!
r0 := (double) b0
r1 := a1
*/
static inline rxmm128d cvtss2sd( rxmm128d a, rxmm128s b )
{
return _mm_cvtss_sd( a, b );
}
/*!
using truncate
r0 := (int) a0
r1 := (int) a1
r2 := 0x0
r3 := 0x0
*/
static inline rxmm128l cvttpd2dq( rxmm128d a )
{
return _mm_cvttpd_epi32( a );
}
/*!
using truncate
r := (int) a0
*/
static inline int cvttsd2si( rxmm128d a )
{
return _mm_cvttsd_si32( a );
}
/*!
r0 := (float) a0
r1 := (float) a1
r2 := (float) a2
r3 := (float) a3
*/
static inline rxmm128s cvtdq2ps( rxmm128l a )
{
return _mm_cvtepi32_ps( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvtps2dq( rxmm128s a )
{
return _mm_cvtps_epi32( a );
}
/*!
uses trancate
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvttps2dq( rxmm128s a )
{
return _mm_cvttps_epi32( a );
}
//
// class pd
//
};
//
// Namespace sse2
//
}
#endif/*_SSE2_CMPL_ABSTRACTION_MSC_PCKDBL_H_*/

View File

@@ -0,0 +1,667 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_MSC_PCKFLOAT_H_
#define _SSE2_CMPL_ABSTRACTION_MSC_PCKFLOAT_H_
//
// Namespace sse2
//
namespace sse2
{
//
/// class ps (packed single precision)
//
class ps
{
public:
//
/// The type.
//
typedef rxmm128s my_rxmm;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double arithmetic
//
/*!
r0 := a0 + b0
r1 := a1 + b1
r2 := a2 + b2
r3 := a3 + b3
*/
static inline rxmm128s add( rxmm128s a, rxmm128s b )
{
return _mm_add_ps( a, b );
}
/*!
r0 := a0 - b0
r1 := a1 - b1
r2 := a2 - b2
r3 := a3 - b3
*/
static inline rxmm128s sub( rxmm128s a, rxmm128s b )
{
return _mm_sub_ps( a, b );
}
/*!
r0 := a0 * b0
r1 := a1 * b1
r2 := a2 * b2
r3 := a3 * b3
*/
static inline rxmm128s mul( rxmm128s a, rxmm128s b )
{
return _mm_mul_ps( a, b );
}
/*!
r0 := a0 / b0
r1 := a1 / b1
r2 := a2 / b2
r3 := a3 / b3
*/
static inline rxmm128s div( rxmm128s a, rxmm128s b )
{
return _mm_div_ps( a, b );
}
/*!
r0 := max(a0, b0)
r1 := max(a1, b1)
r2 := max(a2, b2)
r3 := max(a3, b3)
*/
static inline rxmm128s max( rxmm128s a, rxmm128s b )
{
return _mm_max_ps( a, b );
}
/*!
r0 := min(a0, b0)
r1 := min(a1, b1)
r2 := min(a2, b2)
r3 := min(a3, b3)
*/
static inline rxmm128s min( rxmm128s a, rxmm128s b )
{
return _mm_min_ps( a, b );
}
/*!
r0 := sqrt(a0)
r1 := sqrt(a1)
r2 := sqrt(a2)
r3 := sqrt(a3)
*/
static inline rxmm128s sqrt( rxmm128s a )
{
return _mm_sqrt_ps( a );
}
/*!
r0 := recip(a0)
r1 := recip(a1)
r2 := recip(a2)
r3 := recip(a3)
*/
static inline rxmm128s rcp( rxmm128s a )
{
return _mm_rcp_ps( a );
}
/*!
r0 := recip(sqrt(a0))
r1 := recip(sqrt(a1))
r2 := recip(sqrt(a2))
r3 := recip(sqrt(a3))
*/
static inline rxmm128s rsqrt( rxmm128s a )
{
return _mm_rsqrt_ps( a );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double logic
//
/*!
r0 := ~a0 & b0
r1 := ~a1 & b1
r2 := ~a2 & b2
r3 := ~a3 & b3
*/
static inline rxmm128s andnot( rxmm128s a, rxmm128s b )
{
return _mm_andnot_ps( a, b );
}
/*!
r0 := a0 & b0
r1 := a1 & b1
*/
static inline XMM_TYPE and( rxmm128s a, rxmm128s b )
{
return _mm_and_ps( a, b );
}
/*!
r0 := a0 | b0
r1 := a1 | b1
*/
static inline XMM_TYPE or( rxmm128s a, rxmm128s b )
{
return _mm_or_ps( a, b );
}
/*!
r0 := a0 ^ b0
r1 := a1 ^ b1
r2 := a2 ^ b2
r3 := a3 ^ b3
*/
static inline XMM_TYPE xor( rxmm128s a, rxmm128s b )
{
return _mm_xor_ps( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double comparision
//
/*!
r0 := (a0 == b0) ? 0xffffffff : 0x0
r1 := (a1 == b1) ? 0xffffffff : 0x0
r2 := (a2 == b2) ? 0xffffffff : 0x0
r3 := (a3 == b3) ? 0xffffffff : 0x0
*/
static inline rxmm128s cmp_eq( rxmm128s a, rxmm128s b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmpeq_ps( a, b );
}
/*!
r0 := (a0 != b0) ? 0xffffffff : 0x0
r1 := (a1 != b1) ? 0xffffffff : 0x0
r2 := (a2 != b2) ? 0xffffffff : 0x0
r3 := (a3 != b3) ? 0xffffffff : 0x0
*/
static inline rxmm128s cmp_neq( rxmm128s a, rxmm128s b )
{
return _mm_cmpneq_ps( a, b );
}
/*!
r0 := (a0 < b0) ? 0xffffffff : 0x0
r1 := (a1 < b1) ? 0xffffffff : 0x0
r2 := (a2 < b2) ? 0xffffffff : 0x0
r3 := (a3 < b3) ? 0xffffffff : 0x0
*/
static inline rxmm128s cmp_lt( rxmm128s a, rxmm128s b )
{
return _mm_cmplt_ps( a, b );
}
/*!
r0 := (a0 <= b0) ? 0xffffffff : 0x0
r1 := (a1 <= b1) ? 0xffffffff : 0x0
r2 := (a2 <= b2) ? 0xffffffff : 0x0
r3 := (a3 <= b3) ? 0xffffffff : 0x0
*/
static inline rxmm128s cmp_le( rxmm128s a, rxmm128s b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmple_ps( a, b );
}
/*!
r0 := (a0 > b0) ? 0xffffffff : 0x0
r1 := (a1 > b1) ? 0xffffffff : 0x0
r2 := (a2 > b2) ? 0xffffffff : 0x0
r3 := (a3 > b3) ? 0xffffffff : 0x0
*/
static inline rxmm128s cmp_gt( rxmm128s a, rxmm128s b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmpgt_ps( a, b );
}
/*!
r0 := (a0 >= b0) ? 0xffffffff : 0x0
r1 := (a1 >= b1) ? 0xffffffff : 0x0
r2 := (a2 >= b2) ? 0xffffffff : 0x0
r3 := (a3 >= b3) ? 0xffffffff : 0x0
*/
static inline rxmm128s cmp_ge( rxmm128s a, rxmm128s b )
{
return _mm_cmpge_ps( a, b );
}
/*!
r0 := (a0 ord b0) ? 0xffffffff : 0x0
r1 := (a1 ord b1) ? 0xffffffff : 0x0
r2 := (a2 ord b2) ? 0xffffffff : 0x0
r3 := (a3 ord b3) ? 0xffffffff : 0x0
*/
static inline rxmm128s cmp_ord( rxmm128s a, rxmm128s b )
{
return _mm_cmpord_ps( a, b );
}
/*!
r0 := (a0 unord b0) ? 0xffffffff : 0x0
r1 := (a1 unord b1) ? 0xffffffff : 0x0
r2 := (a2 unord b2) ? 0xffffffff : 0x0
r3 := (a3 unord b3) ? 0xffffffff : 0x0
*/
static inline rxmm128s cmp_unord( rxmm128s a, rxmm128s b )
{
return _mm_cmpunord_ps( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double load
//
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Misc
/*!
r0 := a2
r1 := b2
r2 := a3
r3 := b3
*/
static inline rxmm128s unpckh( rxmm128s a, rxmm128s b )
{
return _mm_unpackhi_ps( a, b );
}
/*!
r0 := a0
r1 := b0
r2 := a1
r3 := b1
*/
static inline rxmm128s unpckl( rxmm128s a, rxmm128s b )
{
return _mm_unpacklo_ps( a, b );
}
/*!
r := sign(a3)<<3 | sign(a2)<<2 | sign(a1)<<1 | sign(a0)
*/
static inline int movmsk( rxmm128s a, rxmm128s b )
{
return _mm_movemask_ps( a, b );
}
/*!
r0 := (i0 == 1) ? b0 : a0
r1 := (i1 == 1) ? b1 : a1
r2 := (i2 == 1) ? b2 : a2
r3 := (i3 == 1) ? b3 : a3
\sa movmsk
*/
static inline int shuffle( rxmm128s a, rxmm128s b, int i )
{
return _mm_shuffle_ps( a, b, i );
}
/*!
r3 := a3
r2 := a2
r1 := b3
r0 := b2
*/
static inline rxmm128s move_hl( rxmm128s a, rxmm128s b )
{
return mm_movehl_ps( a0 );
}
/*!
r3 := b1
r2 := b0
r1 := a1
r0 := a0
*/
static inline rxmm128s move_lh( rxmm128s a, rxmm128s b )
{
return _mm_movelh_ps( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory load
/*!
The address \arg p must be 16-byte aligned.
r0 := p[0]
r1 := p[1]
r2 := p[2]
r3 := p[3]
*/
static inline rxmm128s load( float * p )
{
return _mm_load_ps( p );
}
/*!
The address \arg p must be 16-byte aligned.
r0 := p[3]
r1 := p[2]
r2 := p[1]
r3 := p[0]
*/
static inline rxmm128s load_reverse( float * p )
{
return _mm_loadr_ps( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := p[0]
r1 := p[1]
r2 := p[2]
r3 := p[3]
*/
static inline rxmm128s load_unaligned( float * p )
{
return _mm_loadu_ps( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := *p
r2 := *p
r3 := *p
*/
static inline rxmm128s load_both( float * p )
{
return _mm_load1_ps( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := 0.0
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128s load_s( float * p )
{
return _mm_load_ss( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory store
/*!
The address \arg p must be 16-byte aligned.
p[0] := a0
p[1] := a1
p[2] := a2
p[3] := a3
*/
static inline void store( float * p, rxmm128s a )
{
_mm_store_ps( p, a );
}
/*!
The address \arg p must be 16-byte aligned.
p[0] := a3
p[1] := a2
p[2] := a1
p[3] := a0
*/
static inline void store_reverse( float * p, rxmm128s a )
{
_mm_storer_ps( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a1
p[2] := a2
p[3] := a3
*/
static inline void store_unaligned(float * p, rxmm128s a )
{
_mm_storeu_ps( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a0
*/
static inline void store_both( float * p, rxmm128s a )
{
return _mm_store1_ps( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_s( float * p, rxmm128s a )
{
return _mm_store_ss( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory set
/*!
r0 := a0
r1 := a1
r2 := a2
r3 := a3
*/
static inline rxmm128s set( float a3, float a2, float a1, float a0 )
{
return _mm_set_ps( a3, a2, a1, a0 );
}
/*!
r0 := 0.0
r1 := 0.0
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128s set_zero()
{
return _mm_setzero_ps( a0 );
}
/*!
r0 := a0
r1 := a0
r2 := a0
r3 := a0
*/
static inline rxmm128s set_both( float a0 )
{
return _mm_set1_ps( a0 );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := 0.0
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128s set_s( float a0 )
{
return _mm_set_ss( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double convertion
//
/*!
r0 := (float) a0
r1 := (float) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128s cvtpd2ps( rxmm128s a )
{
return _mm_cvtpd_ps( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128s cvtps2pd( rxmm128s a )
{
return _mm_cvtps_ps( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l cvtpd2dq( rxmm128s a )
{
return _mm_cvtpd_epi32( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128s cvtdq2pd( rxmm128l a )
{
return _mm_cvtepi32_ps( a );
}
/*!
r := (int) a0
*/
static inline int cvtsd2si( rxmm128s a )
{
return _mm_cvtsd_si32( a );
}
/*!
r0 := (float) b0
r1 := a1
r2 := a2
r3 := a3
*/
static inline rxmm128s cvtsd2ss( rxmm128l a, rxmm128s b )
{
return _mm_cvtsd_ss( a, b );
}
/*!
r0 := (double) b
r1 := a1
*/
static inline rxmm128s cvtsi2sd( rxmm128s a, int b )
{
return _mm_cvtsi32_sd( a, b );
}
/*!
r0 := (double) b0
r1 := a1
*/
static inline rxmm128s cvtss2sd( rxmm128s a, rxmm128s b )
{
return _mm_cvtss_sd( a, b );
}
/*!
using truncate
r0 := (int) a0
r1 := (int) a1
r2 := 0x0
r3 := 0x0
*/
static inline rxmm128l cvttpd2dq( rxmm128s a )
{
return _mm_cvttpd_epi32( a );
}
/*!
using truncate
r := (int) a0
*/
static inline int cvttsd2si( rxmm128s a )
{
return _mm_cvttsd_si32( a );
}
/*!
r0 := (float) a0
r1 := (float) a1
r2 := (float) a2
r3 := (float) a3
*/
static inline rxmm128s cvtdq2ps( rxmm128l a )
{
return _mm_cvtepi32_ps( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvtps2dq( rxmm128s a )
{
return _mm_cvtps_epi32( a );
}
/*!
uses trancate
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvttps2dq( rxmm128s a )
{
return _mm_cvttps_epi32( a );
}
//
// class ps
//
};
//
// Namespace sse2
//
}
#endif/*_SSE2_CMPL_ABSTRACTION_MSC_PCKFLOAT_H_*/

View File

@@ -0,0 +1,618 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_MSC_PCKINT16_H_
#define _SSE2_CMPL_ABSTRACTION_MSC_PCKINT16_H_
//
// Namespace sse2
//
namespace sse2
{
//
/// class epi64 (packed single precision)
//
class epi64
{
public:
//
/// The type.
//
typedef rxmm128l my_rxmm;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer arithmetic
//
/*!
r0 := a0 + b0
r1 := a1 + b1
*/
static inline rxmm128d add( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_add_pd( a, b );
}
/*!
r0 := a0 - b0
r1 := a1 - b1
*/
static inline rxmm128d sub( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_sub_pd( a, b );
}
/*!
r0 := a0 * b0
r1 := a1 * b1
*/
static inline rxmm128d mul( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_mul_pd( a, b );
}
/*!
r0 := a0 / b0
r1 := a1 / b1
*/
static inline rxmm128d div( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_div_pd( a, b );
}
/*!
r0 := max( a0, b0 )
r1 := max( a1, b1 )
*/
static inline rxmm128d max( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_max_pd( a, b );
}
/*!
r0 := min( a0, b0 )
r1 := min( a1, b1 )
*/
static inline rxmm128d min( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_min_pd( a, b );
}
/*!
r0 := sqrt( a0 )
r1 := sqrt( a1 )
*/
static inline rxmm128d sqrt( rxmm128d a )
{
BOOST_STATIC_ASSERT( false );
return _mm_sqrt_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer logic
//
/*!
r0 := (~a0) & b0
r1 := (~a1) & b1
*/
static inline rxmm128d andnot( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_andnot_pd( a, b );
}
/*!
r0 := a0 & b0
r1 := a1 & b1
*/
static inline XMM_TYPE and( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_and_pd( a, b );
}
/*!
r0 := a0 | b0
r1 := a1 | b1
*/
static inline XMM_TYPE or( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_or_pd( a, b );
}
/*!
r0 := a0 ^ b0
r1 := a1 ^ b1
*/
static inline XMM_TYPE xor( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_xor_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer comparision
//
/*!
r0 := (a0 == b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 == b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_eq( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmpeq_pd( a, b );
}
/*!
r0 := (a0 != b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 != b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_neq( rxmm128d a, rxmm128d b )
{
return _mm_cmpneq_pd( a, b );
}
/*!
r0 := (a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 < b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_lt( rxmm128d a, rxmm128d b )
{
return _mm_cmplt_pd( a, b );
}
/*!
r0 := (a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 <= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_le( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmple_pd( a, b );
}
/*!
r0 := (a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 > b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_gt( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmpgt_pd( a, b );
}
/*!
r0 := (a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 >= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ge( rxmm128d a, rxmm128d b )
{
return _mm_cmpge_pd( a, b );
}
/*!
r0 := (a0 ord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 ord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ord( rxmm128d a, rxmm128d b )
{
return _mm_cmpord_pd( a, b );
}
/*!
r0 := (a0 unord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 unord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_unord( rxmm128d a, rxmm128d b )
{
return _mm_cmpunord_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer load
//
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Misc
/*!
r0 := a1
r1 := b1
*/
static inline rxmm128d unpckh( rxmm128d a, rxmm128d b )
{
return _mm_unpackhi_pd( a, b );
}
/*!
r0 := a0
r1 := b0
*/
static inline rxmm128d unpckl( rxmm128d a, rxmm128d b )
{
return _mm_unpacklo_pd( a, b );
}
/*!
r := sign(a1) << 1 | sign(a0)
*/
static inline int movmsk( rxmm128d a, rxmm128d b )
{
return _mm_movemask_pd( a, b );
}
/*!
r0 := (i0 == 1) ? b0 : a0
r1 := (i1 == 1) ? b1 : a1
\sa movmsk
*/
static inline int shuffle( rxmm128d a, rxmm128d b, int i )
{
return _mm_shuffle_pd( a, b, i );
}
/*!
== shuffle( a, b, 1 )
r0 := b0
r1 := a1
*/
static inline rxmm128d move_sd( rxmm128d a, rxmm128d b )
{
return _mm_move_sd( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory load
/*!
The address \arg p must be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load( double * p )
{
return _mm_load_pd( p );
}
/*!
The address \arg p must be 16-byte aligned.
r0 := p[1]
r1 := p[0]
*/
static inline rxmm128d load_reverse( double * p )
{
return _mm_loadr_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load_unaligned( double * p )
{
return _mm_loadu_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := *p
*/
static inline rxmm128d load_hi( rxmm128d a, double * p )
{
return _mm_loadh_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := a1
*/
static inline rxmm128d load_lo( rxmm128d a, double * p )
{
return _mm_loadl_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := *p
*/
static inline rxmm128d load_both( double * p )
{
return _mm_load1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := 0.0
*/
static inline rxmm128d load_sd( double * p )
{
return _mm_load_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory store
/*!
The address \arg p must be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store( double * p, rxmm128d a )
{
_mm_load_pd( p, a );
}
/*!
The address \arg p must be 16-byte aligned.
p[0] := a1
p[1] := a0
*/
static inline void store_reverse( double * p, rxmm128d a )
{
_mm_storer_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store_unaligned(double * p, rxmm128d a )
{
_mm_storeu_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a1
*/
static inline void store_hi( double * p, rxmm128d a )
{
_mm_storeh_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_lo( double * p, rxmm128d a )
{
_mm_storel_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a0
*/
static inline void store_both( double * p, rxmm128d a )
{
return _mm_store1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_sd( double * p, rxmm128d a )
{
return _mm_store_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory set
/*!
r0 := a0
r1 := a1
*/
static inline rxmm128d set( double a1, double a0 )
{
return _mm_set_pd( a1, a0 );
}
/*!
r0 := 0.0
r1 := 0.0
*/
static inline rxmm128d set_zero()
{
return _mm_setzero_pd( a0 );
}
/*!
r0 := a0
r1 := a0
*/
static inline rxmm128d set_both( double a0 )
{
return _mm_set1_pd( a0 );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := 0.0
*/
static inline rxmm128d set_sd( double a0 )
{
return _mm_set_sd( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer convertion
//
/*!
r0 := (float) a0
r1 := (float) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128s cvtpd2ps( rxmm128d a )
{
return _mm_cvtpd_ps( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtps2pd( rxmm128s a )
{
return _mm_cvtps_pd( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l cvtpd2dq( rxmm128d a )
{
return _mm_cvtpd_epi32( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtdq2pd( rxmm128l a )
{
return _mm_cvtepi32_pd( a );
}
/*!
r := (int) a0
*/
static inline int cvtsd2si( rxmm128d a )
{
return _mm_cvtsd_si32( a );
}
/*!
r0 := (float) b0
r1 := a1
r2 := a2
r3 := a3
*/
static inline rxmm128s cvtsd2ss( rxmm128l a, rxmm128d b )
{
return _mm_cvtsd_ss( a, b );
}
/*!
r0 := (double) b
r1 := a1
*/
static inline rxmm128d cvtsi2sd( rxmm128d a, int b )
{
return _mm_cvtsi32_sd( a, b );
}
/*!
r0 := (double) b0
r1 := a1
*/
static inline rxmm128d cvtss2sd( rxmm128d a, rxmm128s b )
{
return _mm_cvtss_sd( a, b );
}
/*!
using truncate
r0 := (int) a0
r1 := (int) a1
r2 := 0x0
r3 := 0x0
*/
static inline rxmm128l cvttpd2dq( rxmm128d a )
{
return _mm_cvttpd_epi32( a );
}
/*!
using truncate
r := (int) a0
*/
static inline int cvttsd2si( rxmm128d a )
{
return _mm_cvttsd_si32( a );
}
/*!
r0 := (float) a0
r1 := (float) a1
r2 := (float) a2
r3 := (float) a3
*/
static inline rxmm128s cvtdq2ps( rxmm128l a )
{
return _mm_cvtepi32_ps( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvtps2dq( rxmm128s a )
{
return _mm_cvtps_epi32( a );
}
/*!
uses trancate
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvttps2dq( rxmm128s a )
{
return _mm_cvttps_epi32( a );
}
//
// class epi64
//
};
//
// Namespace sse2
//
}
#endif/*_SSE2_CMPL_ABSTRACTION_MSC_PCKINT16_H_*/

View File

@@ -0,0 +1,676 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_MSC_PCKINT32_H_
#define _SSE2_CMPL_ABSTRACTION_MSC_PCKINT32_H_
//
// Namespace sse2
//
namespace sse2
{
//
/// class epi64 (packed single precision)
//
class epi64
{
public:
//
/// The type.
//
typedef rxmm128l my_rxmm;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer arithmetic
//
/*!
r0 := a0 + b0
r1 := a1 + b1
r2 := a2 + b2
r3 := a3 + b3
*/
static inline rxmm128l add( rxmm128l a, rxmm128l b )
{
return _mm_add_epi32( a, b );
}
/*!
r0 := a0 - b0
r1 := a1 - b1
r2 := a2 - b2
r3 := a3 - b3
*/
static inline rxmm128l sub( rxmm128l a, rxmm128l b )
{
return _mm_sub_epi32( a, b );
}
/*!
r0 := a0 * b0
r1 := a1 * b1
r2 := a2 * b2
r3 := a3 * b3
\note Emulating through float. May be precision loss.
*/
static inline rxmm128l mul( rxmm128l a, rxmm128l b )
{
register rxmm128s t = _mm_cvtepi32_ps( a );
register rxmm128s u = _mm_cvtepi32_ps( b );
register rxmm128s v = _mm_mul_ps( t, u );
return _mm_cvtps_epi32( v );
}
/*!
r0 := a0 / b0
r1 := a1 / b1
r2 := a2 / b2
r3 := a3 / b3
\note Emulating through float. May be precision loss.
*/
static inline rxmm128l div( rxmm128l a, rxmm128l b )
{
register rxmm128s t = _mm_cvtepi32_ps( a );
register rxmm128s u = _mm_cvtepi32_ps( b );
register rxmm128s v = _mm_div_ps( t, u );
return _mm_cvtps_epi32( v );
}
/*!
r0 := max(a0, b0)
r1 := max(a1, b1)
r2 := max(a2, b2)
r3 := max(a3, b3)
*/
static inline rxmm128l max( rxmm128l a, rxmm128l b )
{
register rxmm128l t = _mm_cmplt_epi32( a, b );
int mask = _mm_movemask_epi8( t );
_mm_shuffle_epi32
BOOST_STATIC_ASSERT( false );
return 0;
}
/*!
r0 := min(a0, b0)
r1 := min(a1, b1)
r2 := min(a2, b2)
r3 := min(a3, b3)
*/
static inline rxmm128l min( rxmm128l a, rxmm128l b )
{
BOOST_STATIC_ASSERT( false );
return 0;
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double logic
//
/*!
r0 := ~a0
r1 := ~a1
r2 := ~a2
r3 := ~a3
*/
static inline rxmm128l not( rxmm128l a )
{
BOOST_STATIC_ASSERT( false );
return _mm_andnot_si128( a, b );
}
/*!
r0 := ~a0 & b0
r1 := ~a1 & b1
r2 := ~a2 & b2
r3 := ~a3 & b3
*/
static inline rxmm128l andnot( rxmm128l a, rxmm128l b )
{
return _mm_andnot_si128( a, b );
}
/*!
r0 := a0 & b0
r1 := a1 & b1
*/
static inline XMM_TYPE and( rxmm128l a, rxmm128l b )
{
return _mm_and_si128( a, b );
}
/*!
r0 := a0 | b0
r1 := a1 | b1
*/
static inline XMM_TYPE or( rxmm128l a, rxmm128l b )
{
return _mm_or_si128( a, b );
}
/*!
r0 := a0 ^ b0
r1 := a1 ^ b1
r2 := a2 ^ b2
r3 := a3 ^ b3
*/
static inline XMM_TYPE xor( rxmm128l a, rxmm128l b )
{
return _mm_xor_si128( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double comparision
//
/*!
r0 := (a0 == b0) ? 0xffffffff : 0x0
r1 := (a1 == b1) ? 0xffffffff : 0x0
r2 := (a2 == b2) ? 0xffffffff : 0x0
r3 := (a3 == b3) ? 0xffffffff : 0x0
*/
static inline rxmm128l cmp_eq( rxmm128l a, rxmm128l b )
{
return _mm_cmpeq_epi32( a, b );
}
/*!
r0 := (a0 != b0) ? 0xffffffff : 0x0
r1 := (a1 != b1) ? 0xffffffff : 0x0
r2 := (a2 != b2) ? 0xffffffff : 0x0
r3 := (a3 != b3) ? 0xffffffff : 0x0
*/
static inline rxmm128l cmp_neq( rxmm128l a, rxmm128l b )
{
rxmm128l t = _mm_cmplt_epi32( a, b );
rxmm128l u = _mm_cmpgt_epi32( a, b );
return _mm_cmpor_si128( t, u );
}
/*!
r0 := (a0 < b0) ? 0xffffffff : 0x0
r1 := (a1 < b1) ? 0xffffffff : 0x0
r2 := (a2 < b2) ? 0xffffffff : 0x0
r3 := (a3 < b3) ? 0xffffffff : 0x0
*/
static inline rxmm128l cmp_lt( rxmm128l a, rxmm128l b )
{
return _mm_cmplt_epi32( a, b );
}
/*!
r0 := (a0 <= b0) ? 0xffffffff : 0x0
r1 := (a1 <= b1) ? 0xffffffff : 0x0
r2 := (a2 <= b2) ? 0xffffffff : 0x0
r3 := (a3 <= b3) ? 0xffffffff : 0x0
*/
static inline rxmm128l cmp_le( rxmm128l a, rxmm128l b )
{
rxmm128l t = _mm_cmplt_epi32( a, b );
rxmm128l u = _mm_cmpeq_epi32( a, b );
return _mm_cmpor_si128( t, u );
}
/*!
r0 := (a0 > b0) ? 0xffffffff : 0x0
r1 := (a1 > b1) ? 0xffffffff : 0x0
r2 := (a2 > b2) ? 0xffffffff : 0x0
r3 := (a3 > b3) ? 0xffffffff : 0x0
*/
static inline rxmm128l cmp_gt( rxmm128l a, rxmm128l b )
{
return _mm_cmpgt_epi32( a, b );
}
/*!
r0 := (a0 >= b0) ? 0xffffffff : 0x0
r1 := (a1 >= b1) ? 0xffffffff : 0x0
r2 := (a2 >= b2) ? 0xffffffff : 0x0
r3 := (a3 >= b3) ? 0xffffffff : 0x0
*/
static inline rxmm128l cmp_ge( rxmm128l a, rxmm128l b )
{
rxmm128l t = _mm_cmpgt_epi32( a, b );
rxmm128l u = _mm_cmpeq_epi32( a, b );
return _mm_cmpor_si128( t, u );
}
/*!
r0 := (a0 ord b0) ? 0xffffffff : 0x0
r1 := (a1 ord b1) ? 0xffffffff : 0x0
r2 := (a2 ord b2) ? 0xffffffff : 0x0
r3 := (a3 ord b3) ? 0xffffffff : 0x0
*/
static inline rxmm128l cmp_ord( rxmm128l a, rxmm128l b )
{
return _mm_cmpord_epi32( a, b );
}
/*!
r0 := (a0 unord b0) ? 0xffffffff : 0x0
r1 := (a1 unord b1) ? 0xffffffff : 0x0
r2 := (a2 unord b2) ? 0xffffffff : 0x0
r3 := (a3 unord b3) ? 0xffffffff : 0x0
*/
static inline rxmm128l cmp_unord( rxmm128l a, rxmm128l b )
{
return _mm_cmpunord_epi32( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer load
//
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Misc
/*!
r0 := a1
r1 := b2
r2 := a3
r3 := b3
*/
static inline rxmm128l unpckh( rxmm128l a, rxmm128l b )
{
BOOST_STATIC_ASSERT( false );
return _mm_unpackhi_epi32( a, b );
}
/*!
r0 := a0
r1 := b0
r2 := a1
r3 := b1
*/
static inline rxmm128l unpckl( rxmm128l a, rxmm128l b )
{
BOOST_STATIC_ASSERT( false );
return _mm_unpacklo_epi32( a, b );
}
/*!
r := sign(a3)<<3 | sign(a2)<<2 | sign(a1)<<1 | sign(a0)
*/
static inline int movmsk( rxmm128l a, rxmm128l b )
{
BOOST_STATIC_ASSERT( false );
return _mm_movemask_epi32( a, b );
}
/*!
r0 := (i0 == 1) ? b0 : a0
r1 := (i1 == 1) ? b1 : a1
r2 := (i2 == 1) ? b2 : a2
r3 := (i3 == 1) ? b3 : a3
\sa movmsk
*/
static inline int shuffle( rxmm128l a, rxmm128l b, int i )
{
BOOST_STATIC_ASSERT( false );
return _mm_shuffle_epi32( a, b, i );
}
/*!
r3 := a3
r2 := a2
r1 := b3
r0 := b2
*/
static inline rxmm128l move_hl( rxmm128l a, rxmm128l b )
{
BOOST_STATIC_ASSERT( false );
return mm_movehl_epi32( a0 );
}
/*!
r3 := b1
r2 := b0
r1 := a1
r0 := a0
*/
static inline rxmm128l move_lh( rxmm128l a, rxmm128l b )
{
BOOST_STATIC_ASSERT( false );
return _mm_movelh_epi32( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory load
/*!
The address \arg p must be 16-byte aligned.
r0 := p[0]
r1 := p[1]
r2 := p[2]
r3 := p[3]
*/
static inline rxmm128l load( int * p )
{
return _mm_load_epi32( reinterpret_cast<__m128i*>(p) );
}
/*!
The address \arg p must be 16-byte aligned.
r0 := p[3]
r1 := p[2]
r2 := p[1]
r3 := p[0]
*/
static inline rxmm128l load_reverse( int * p )
{
BOOST_STATIC_ASSERT( false );
rxmm128l t = _mm_loadr_epi32( reinterpret_cast<__m128i*>(p) )
return _mm_loadr_epi32( reinterpret_cast<__m128i*>(p) );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := p[0]
r1 := p[1]
r2 := p[2]
r3 := p[3]
*/
static inline rxmm128l load_unaligned( int * p )
{
return _mm_loadu_epi32( reinterpret_cast<__m128i*>(p) );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := *p
r2 := *p
r3 := *p
*/
static inline rxmm128l load_both( int * p )
{
BOOST_STATIC_ASSERT( false );
return _mm_load1_epi32( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := 0.0
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l load_s( int * p )
{
BOOST_STATIC_ASSERT( false );
return _mm_load_ss( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory store
/*!
The address \arg p must be 16-byte aligned.
p[0] := a0
p[1] := a1
p[2] := a2
p[3] := a3
*/
static inline void store( int * p, rxmm128l a )
{
_mm_store_si128( reinterpret_cast<__m128i*>(p), a );
}
/*!
The address \arg p must be 16-byte aligned.
p[0] := a3
p[1] := a2
p[2] := a1
p[3] := a0
*/
static inline void store_reverse( int * p, rxmm128l a )
{
BOOST_STATIC_ASSERT( false );
_mm_storer_epi32( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a1
p[2] := a2
p[3] := a3
*/
static inline void store_unaligned(int * p, rxmm128l a )
{
_mm_storeu_si128( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a0
*/
static inline void store_both( int * p, rxmm128l a )
{
BOOST_STATIC_ASSERT( false );
return _mm_store1_epi32( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_s( int * p, rxmm128l a )
{
BOOST_STATIC_ASSERT( false );
return _mm_store_ss( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory set
/*!
r0 := a0
r1 := a1
r2 := a2
r3 := a3
*/
static inline rxmm128l set( int a3, int a2, int a1, int a0 )
{
return _mm_set_epi32( a3, a2, a1, a0 );
}
/*!
r0 := 0.0
r1 := 0.0
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l set_zero()
{
return _mm_setzero_si32( a0 );
}
/*!
r0 := a0
r1 := a0
r2 := a0
r3 := a0
*/
static inline rxmm128l set_both( int a0 )
{
return _mm_set1_epi32( a0 );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := 0.0
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l set_s( int a0 )
{
BOOST_STATIC_ASSERT( false );
return _mm_set_ss( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed double convertion
//
/*!
r0 := (float) a0
r1 := (float) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l cvtpd2ps( rxmm128l a )
{
return _mm_cvtpd_epi32( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128l cvtps2pd( rxmm128l a )
{
return _mm_cvtps_epi32( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l cvtpd2dq( rxmm128l a )
{
return _mm_cvtpd_epi32( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128l cvtdq2pd( rxmm128l a )
{
return _mm_cvtepi32_epi32( a );
}
/*!
r := (int) a0
*/
static inline int cvtsd2si( rxmm128l a )
{
return _mm_cvtsd_si32( a );
}
/*!
r0 := (float) b0
r1 := a1
r2 := a2
r3 := a3
*/
static inline rxmm128l cvtsd2ss( rxmm128l a, rxmm128l b )
{
return _mm_cvtsd_ss( a, b );
}
/*!
r0 := (double) b
r1 := a1
*/
static inline rxmm128l cvtsi2sd( rxmm128l a, int b )
{
return _mm_cvtsi32_sd( a, b );
}
/*!
r0 := (double) b0
r1 := a1
*/
static inline rxmm128l cvtss2sd( rxmm128l a, rxmm128l b )
{
return _mm_cvtss_sd( a, b );
}
/*!
using truncate
r0 := (int) a0
r1 := (int) a1
r2 := 0x0
r3 := 0x0
*/
static inline rxmm128l cvttpd2dq( rxmm128l a )
{
return _mm_cvttpd_epi32( a );
}
/*!
using truncate
r := (int) a0
*/
static inline int cvttsd2si( rxmm128l a )
{
return _mm_cvttsd_si32( a );
}
/*!
r0 := (float) a0
r1 := (float) a1
r2 := (float) a2
r3 := (float) a3
*/
static inline rxmm128l cvtdq2ps( rxmm128l a )
{
return _mm_cvtepi32_epi32( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvtps2dq( rxmm128l a )
{
return _mm_cvtps_epi32( a );
}
/*!
uses trancate
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvttps2dq( rxmm128l a )
{
return _mm_cvttps_epi32( a );
}
//
// class epi64
//
};
//
// Namespace sse2
//
}
#endif/*_SSE2_CMPL_ABSTRACTION_MSC_PCKINT32_H_*/

View File

@@ -0,0 +1,618 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_MSC_PCKINT64_H_
#define _SSE2_CMPL_ABSTRACTION_MSC_PCKINT64_H_
//
// Namespace sse2
//
namespace sse2
{
//
/// class epi64 (packed single precision)
//
class epi64
{
public:
//
/// The type.
//
typedef rxmm128l my_rxmm;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer arithmetic
//
/*!
r0 := a0 + b0
r1 := a1 + b1
*/
static inline rxmm128d add( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_add_pd( a, b );
}
/*!
r0 := a0 - b0
r1 := a1 - b1
*/
static inline rxmm128d sub( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_sub_pd( a, b );
}
/*!
r0 := a0 * b0
r1 := a1 * b1
*/
static inline rxmm128d mul( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_mul_pd( a, b );
}
/*!
r0 := a0 / b0
r1 := a1 / b1
*/
static inline rxmm128d div( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_div_pd( a, b );
}
/*!
r0 := max( a0, b0 )
r1 := max( a1, b1 )
*/
static inline rxmm128d max( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_max_pd( a, b );
}
/*!
r0 := min( a0, b0 )
r1 := min( a1, b1 )
*/
static inline rxmm128d min( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_min_pd( a, b );
}
/*!
r0 := sqrt( a0 )
r1 := sqrt( a1 )
*/
static inline rxmm128d sqrt( rxmm128d a )
{
BOOST_STATIC_ASSERT( false );
return _mm_sqrt_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer logic
//
/*!
r0 := (~a0) & b0
r1 := (~a1) & b1
*/
static inline rxmm128d andnot( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_andnot_pd( a, b );
}
/*!
r0 := a0 & b0
r1 := a1 & b1
*/
static inline XMM_TYPE and( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_and_pd( a, b );
}
/*!
r0 := a0 | b0
r1 := a1 | b1
*/
static inline XMM_TYPE or( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_or_pd( a, b );
}
/*!
r0 := a0 ^ b0
r1 := a1 ^ b1
*/
static inline XMM_TYPE xor( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_xor_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer comparision
//
/*!
r0 := (a0 == b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 == b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_eq( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmpeq_pd( a, b );
}
/*!
r0 := (a0 != b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 != b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_neq( rxmm128d a, rxmm128d b )
{
return _mm_cmpneq_pd( a, b );
}
/*!
r0 := (a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 < b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_lt( rxmm128d a, rxmm128d b )
{
return _mm_cmplt_pd( a, b );
}
/*!
r0 := (a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 <= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_le( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmple_pd( a, b );
}
/*!
r0 := (a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 > b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_gt( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmpgt_pd( a, b );
}
/*!
r0 := (a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 >= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ge( rxmm128d a, rxmm128d b )
{
return _mm_cmpge_pd( a, b );
}
/*!
r0 := (a0 ord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 ord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ord( rxmm128d a, rxmm128d b )
{
return _mm_cmpord_pd( a, b );
}
/*!
r0 := (a0 unord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 unord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_unord( rxmm128d a, rxmm128d b )
{
return _mm_cmpunord_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer load
//
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Misc
/*!
r0 := a1
r1 := b1
*/
static inline rxmm128d unpckh( rxmm128d a, rxmm128d b )
{
return _mm_unpackhi_pd( a, b );
}
/*!
r0 := a0
r1 := b0
*/
static inline rxmm128d unpckl( rxmm128d a, rxmm128d b )
{
return _mm_unpacklo_pd( a, b );
}
/*!
r := sign(a1) << 1 | sign(a0)
*/
static inline int movmsk( rxmm128d a, rxmm128d b )
{
return _mm_movemask_pd( a, b );
}
/*!
r0 := (i0 == 1) ? b0 : a0
r1 := (i1 == 1) ? b1 : a1
\sa movmsk
*/
static inline int shuffle( rxmm128d a, rxmm128d b, int i )
{
return _mm_shuffle_pd( a, b, i );
}
/*!
== shuffle( a, b, 1 )
r0 := b0
r1 := a1
*/
static inline rxmm128d move_sd( rxmm128d a, rxmm128d b )
{
return _mm_move_sd( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory load
/*!
The address \arg p must be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load( double * p )
{
return _mm_load_pd( p );
}
/*!
The address \arg p must be 16-byte aligned.
r0 := p[1]
r1 := p[0]
*/
static inline rxmm128d load_reverse( double * p )
{
return _mm_loadr_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load_unaligned( double * p )
{
return _mm_loadu_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := *p
*/
static inline rxmm128d load_hi( rxmm128d a, double * p )
{
return _mm_loadh_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := a1
*/
static inline rxmm128d load_lo( rxmm128d a, double * p )
{
return _mm_loadl_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := *p
*/
static inline rxmm128d load_both( double * p )
{
return _mm_load1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := 0.0
*/
static inline rxmm128d load_sd( double * p )
{
return _mm_load_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory store
/*!
The address \arg p must be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store( double * p, rxmm128d a )
{
_mm_load_pd( p, a );
}
/*!
The address \arg p must be 16-byte aligned.
p[0] := a1
p[1] := a0
*/
static inline void store_reverse( double * p, rxmm128d a )
{
_mm_storer_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store_unaligned(double * p, rxmm128d a )
{
_mm_storeu_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a1
*/
static inline void store_hi( double * p, rxmm128d a )
{
_mm_storeh_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_lo( double * p, rxmm128d a )
{
_mm_storel_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a0
*/
static inline void store_both( double * p, rxmm128d a )
{
return _mm_store1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_sd( double * p, rxmm128d a )
{
return _mm_store_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory set
/*!
r0 := a0
r1 := a1
*/
static inline rxmm128d set( double a1, double a0 )
{
return _mm_set_pd( a1, a0 );
}
/*!
r0 := 0.0
r1 := 0.0
*/
static inline rxmm128d set_zero()
{
return _mm_setzero_pd( a0 );
}
/*!
r0 := a0
r1 := a0
*/
static inline rxmm128d set_both( double a0 )
{
return _mm_set1_pd( a0 );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := 0.0
*/
static inline rxmm128d set_sd( double a0 )
{
return _mm_set_sd( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer convertion
//
/*!
r0 := (float) a0
r1 := (float) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128s cvtpd2ps( rxmm128d a )
{
return _mm_cvtpd_ps( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtps2pd( rxmm128s a )
{
return _mm_cvtps_pd( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l cvtpd2dq( rxmm128d a )
{
return _mm_cvtpd_epi32( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtdq2pd( rxmm128l a )
{
return _mm_cvtepi32_pd( a );
}
/*!
r := (int) a0
*/
static inline int cvtsd2si( rxmm128d a )
{
return _mm_cvtsd_si32( a );
}
/*!
r0 := (float) b0
r1 := a1
r2 := a2
r3 := a3
*/
static inline rxmm128s cvtsd2ss( rxmm128l a, rxmm128d b )
{
return _mm_cvtsd_ss( a, b );
}
/*!
r0 := (double) b
r1 := a1
*/
static inline rxmm128d cvtsi2sd( rxmm128d a, int b )
{
return _mm_cvtsi32_sd( a, b );
}
/*!
r0 := (double) b0
r1 := a1
*/
static inline rxmm128d cvtss2sd( rxmm128d a, rxmm128s b )
{
return _mm_cvtss_sd( a, b );
}
/*!
using truncate
r0 := (int) a0
r1 := (int) a1
r2 := 0x0
r3 := 0x0
*/
static inline rxmm128l cvttpd2dq( rxmm128d a )
{
return _mm_cvttpd_epi32( a );
}
/*!
using truncate
r := (int) a0
*/
static inline int cvttsd2si( rxmm128d a )
{
return _mm_cvttsd_si32( a );
}
/*!
r0 := (float) a0
r1 := (float) a1
r2 := (float) a2
r3 := (float) a3
*/
static inline rxmm128s cvtdq2ps( rxmm128l a )
{
return _mm_cvtepi32_ps( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvtps2dq( rxmm128s a )
{
return _mm_cvtps_epi32( a );
}
/*!
uses trancate
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvttps2dq( rxmm128s a )
{
return _mm_cvttps_epi32( a );
}
//
// class epi64
//
};
//
// Namespace sse2
//
}
#endif/*_SSE2_CMPL_ABSTRACTION_MSC_PCKINT64_H_*/

View File

@@ -0,0 +1,618 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_MSC_PCKINT8_H_
#define _SSE2_CMPL_ABSTRACTION_MSC_PCKINT8_H_
//
// Namespace sse2
//
namespace sse2
{
//
/// class epi64 (packed single precision)
//
class epi64
{
public:
//
/// The type.
//
typedef rxmm128l my_rxmm;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer arithmetic
//
/*!
r0 := a0 + b0
r1 := a1 + b1
*/
static inline rxmm128d add( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_add_pd( a, b );
}
/*!
r0 := a0 - b0
r1 := a1 - b1
*/
static inline rxmm128d sub( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_sub_pd( a, b );
}
/*!
r0 := a0 * b0
r1 := a1 * b1
*/
static inline rxmm128d mul( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_mul_pd( a, b );
}
/*!
r0 := a0 / b0
r1 := a1 / b1
*/
static inline rxmm128d div( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_div_pd( a, b );
}
/*!
r0 := max( a0, b0 )
r1 := max( a1, b1 )
*/
static inline rxmm128d max( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_max_pd( a, b );
}
/*!
r0 := min( a0, b0 )
r1 := min( a1, b1 )
*/
static inline rxmm128d min( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_min_pd( a, b );
}
/*!
r0 := sqrt( a0 )
r1 := sqrt( a1 )
*/
static inline rxmm128d sqrt( rxmm128d a )
{
BOOST_STATIC_ASSERT( false );
return _mm_sqrt_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer logic
//
/*!
r0 := (~a0) & b0
r1 := (~a1) & b1
*/
static inline rxmm128d andnot( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_andnot_pd( a, b );
}
/*!
r0 := a0 & b0
r1 := a1 & b1
*/
static inline XMM_TYPE and( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_and_pd( a, b );
}
/*!
r0 := a0 | b0
r1 := a1 | b1
*/
static inline XMM_TYPE or( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_or_pd( a, b );
}
/*!
r0 := a0 ^ b0
r1 := a1 ^ b1
*/
static inline XMM_TYPE xor( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_xor_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer comparision
//
/*!
r0 := (a0 == b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 == b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_eq( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmpeq_pd( a, b );
}
/*!
r0 := (a0 != b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 != b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_neq( rxmm128d a, rxmm128d b )
{
return _mm_cmpneq_pd( a, b );
}
/*!
r0 := (a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 < b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_lt( rxmm128d a, rxmm128d b )
{
return _mm_cmplt_pd( a, b );
}
/*!
r0 := (a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 <= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_le( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmple_pd( a, b );
}
/*!
r0 := (a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 > b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_gt( rxmm128d a, rxmm128d b )
{
BOOST_STATIC_ASSERT( false );
return _mm_cmpgt_pd( a, b );
}
/*!
r0 := (a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 >= b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ge( rxmm128d a, rxmm128d b )
{
return _mm_cmpge_pd( a, b );
}
/*!
r0 := (a0 ord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 ord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_ord( rxmm128d a, rxmm128d b )
{
return _mm_cmpord_pd( a, b );
}
/*!
r0 := (a0 unord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 unord b1) ? 0xffffffffffffffff : 0x0
*/
static inline rxmm128d cmp_unord( rxmm128d a, rxmm128d b )
{
return _mm_cmpunord_pd( a, b );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer load
//
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Misc
/*!
r0 := a1
r1 := b1
*/
static inline rxmm128d unpckh( rxmm128d a, rxmm128d b )
{
return _mm_unpackhi_pd( a, b );
}
/*!
r0 := a0
r1 := b0
*/
static inline rxmm128d unpckl( rxmm128d a, rxmm128d b )
{
return _mm_unpacklo_pd( a, b );
}
/*!
r := sign(a1) << 1 | sign(a0)
*/
static inline int movmsk( rxmm128d a, rxmm128d b )
{
return _mm_movemask_pd( a, b );
}
/*!
r0 := (i0 == 1) ? b0 : a0
r1 := (i1 == 1) ? b1 : a1
\sa movmsk
*/
static inline int shuffle( rxmm128d a, rxmm128d b, int i )
{
return _mm_shuffle_pd( a, b, i );
}
/*!
== shuffle( a, b, 1 )
r0 := b0
r1 := a1
*/
static inline rxmm128d move_sd( rxmm128d a, rxmm128d b )
{
return _mm_move_sd( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory load
/*!
The address \arg p must be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load( double * p )
{
return _mm_load_pd( p );
}
/*!
The address \arg p must be 16-byte aligned.
r0 := p[1]
r1 := p[0]
*/
static inline rxmm128d load_reverse( double * p )
{
return _mm_loadr_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := p[0]
r1 := p[1]
*/
static inline rxmm128d load_unaligned( double * p )
{
return _mm_loadu_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := *p
*/
static inline rxmm128d load_hi( rxmm128d a, double * p )
{
return _mm_loadh_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := a1
*/
static inline rxmm128d load_lo( rxmm128d a, double * p )
{
return _mm_loadl_pd( a, p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := *p
*/
static inline rxmm128d load_both( double * p )
{
return _mm_load1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := *p
r1 := 0.0
*/
static inline rxmm128d load_sd( double * p )
{
return _mm_load_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory store
/*!
The address \arg p must be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store( double * p, rxmm128d a )
{
_mm_load_pd( p, a );
}
/*!
The address \arg p must be 16-byte aligned.
p[0] := a1
p[1] := a0
*/
static inline void store_reverse( double * p, rxmm128d a )
{
_mm_storer_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a1
*/
static inline void store_unaligned(double * p, rxmm128d a )
{
_mm_storeu_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a1
*/
static inline void store_hi( double * p, rxmm128d a )
{
_mm_storeh_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_lo( double * p, rxmm128d a )
{
_mm_storel_pd( p, a );
}
/*!
The address \arg p does not need to be 16-byte aligned.
p[0] := a0
p[1] := a0
*/
static inline void store_both( double * p, rxmm128d a )
{
return _mm_store1_pd( p );
}
/*!
The address \arg p does not need to be 16-byte aligned.
*p := a0
*/
static inline void store_sd( double * p, rxmm128d a )
{
return _mm_store_sd( p );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// Memory set
/*!
r0 := a0
r1 := a1
*/
static inline rxmm128d set( double a1, double a0 )
{
return _mm_set_pd( a1, a0 );
}
/*!
r0 := 0.0
r1 := 0.0
*/
static inline rxmm128d set_zero()
{
return _mm_setzero_pd( a0 );
}
/*!
r0 := a0
r1 := a0
*/
static inline rxmm128d set_both( double a0 )
{
return _mm_set1_pd( a0 );
}
/*!
The address \arg p does not need to be 16-byte aligned.
r0 := a0
r1 := 0.0
*/
static inline rxmm128d set_sd( double a0 )
{
return _mm_set_sd( a0 );
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//
/// Packed integer convertion
//
/*!
r0 := (float) a0
r1 := (float) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128s cvtpd2ps( rxmm128d a )
{
return _mm_cvtpd_ps( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtps2pd( rxmm128s a )
{
return _mm_cvtps_pd( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := 0.0
r3 := 0.0
*/
static inline rxmm128l cvtpd2dq( rxmm128d a )
{
return _mm_cvtpd_epi32( a );
}
/*!
r0 := (double) a0
r1 := (double) a1
*/
static inline rxmm128d cvtdq2pd( rxmm128l a )
{
return _mm_cvtepi32_pd( a );
}
/*!
r := (int) a0
*/
static inline int cvtsd2si( rxmm128d a )
{
return _mm_cvtsd_si32( a );
}
/*!
r0 := (float) b0
r1 := a1
r2 := a2
r3 := a3
*/
static inline rxmm128s cvtsd2ss( rxmm128l a, rxmm128d b )
{
return _mm_cvtsd_ss( a, b );
}
/*!
r0 := (double) b
r1 := a1
*/
static inline rxmm128d cvtsi2sd( rxmm128d a, int b )
{
return _mm_cvtsi32_sd( a, b );
}
/*!
r0 := (double) b0
r1 := a1
*/
static inline rxmm128d cvtss2sd( rxmm128d a, rxmm128s b )
{
return _mm_cvtss_sd( a, b );
}
/*!
using truncate
r0 := (int) a0
r1 := (int) a1
r2 := 0x0
r3 := 0x0
*/
static inline rxmm128l cvttpd2dq( rxmm128d a )
{
return _mm_cvttpd_epi32( a );
}
/*!
using truncate
r := (int) a0
*/
static inline int cvttsd2si( rxmm128d a )
{
return _mm_cvttsd_si32( a );
}
/*!
r0 := (float) a0
r1 := (float) a1
r2 := (float) a2
r3 := (float) a3
*/
static inline rxmm128s cvtdq2ps( rxmm128l a )
{
return _mm_cvtepi32_ps( a );
}
/*!
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvtps2dq( rxmm128s a )
{
return _mm_cvtps_epi32( a );
}
/*!
uses trancate
r0 := (int) a0
r1 := (int) a1
r2 := (int) a2
r3 := (int) a3
*/
static inline rxmm128l cvttps2dq( rxmm128s a )
{
return _mm_cvttps_epi32( a );
}
//
// class epi64
//
};
//
// Namespace sse2
//
}
#endif/*_SSE2_CMPL_ABSTRACTION_MSC_PCKINT8_H_*/

View File

@@ -0,0 +1,60 @@
/*
* SYNOPSYS CONFIDENTIAL - This is an unpublished, proprietary work of Synopsys,
* Inc., and is fully protected under copyright and trade secret laws. You may
* not view, use, disclose, copy, or distribute this file or any information
* contained herein except pursuant to a valid written license from Synopsys.
*/
//
// The purpose of this file is to define SSE2 data types to abstacr from the compiler
// specific constructs. Currently the target compilers are GCC and the MS VC 2005.
//
#ifndef _SSE2_CMPL_ABSTRACTION_OTHER_H_
#define _SSE2_CMPL_ABSTRACTION_OTHER_H_
#include <boost/static_assert.hpp>
//
// Namespace sse2
//
namespace sse2
{
//
// Primitive types
//
/// 2xdouble
//
typedef char xmm128d[16];
/// 4xfloat
//
typedef char xmm128s[16];
/// 2xint64
//
typedef char xmm128l[16];
/// 4xint32
//
typedef char xmm128i[16];
/// int64
//
typedef long int;
//
// Namespace sse2
//
}
#include "SSE_cmplr_abstraction_other_pckdbl.h"
#include "SSE_cmplr_abstraction_other_pckfloat.h"
#include "SSE_cmplr_abstraction_other_pckint8.h"
#include "SSE_cmplr_abstraction_other_pckint16.h"
#include "SSE_cmplr_abstraction_other_pckint32.h"
#include "SSE_cmplr_abstraction_other_pckint64.h"
#endif/*_SSE2_CMPL_ABSTRACTION_OTHER_H_*/

43
SSE_transform.cpp Normal file
View File

@@ -0,0 +1,43 @@
// toIntTest.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include "getCurrentTime.h"
#include "base/transform.h"
//#include "base/point.h"
#if !defined(__AIX) && !defined(__sparc)
#define LOW_ENDIAN_ARCH
#endif
#ifdef _MSC_VER
#define MY_INLINE __forceinline
#else
#define MY_INLINE inline
#endif
#ifndef _MSC_VER
#define __int64 long
#endif
void test1()
{
}
void test2()
{
}
int main(int argc, char* argv[])
{
// Init
initGetCurrentTimeLib();
// test1();
test2();
return 0;
}

View File

@@ -0,0 +1,35 @@
#include <iostream>
struct a
{
int m;
a()
: m(0)
{}
a( int e )
: m(e)
{}
//private:
// a( const a & _ )
// : m( _.m+1)
// {}
};
struct b : public a
{
int n;
b()
: n(0)
{}
};
int main()
{
a o;
a o2 = o;
std::cout << o2.m << std::endl;
// std::cout << o2.m <<' '<<o2.n<< std::endl;
return 0;
}

23
boost_variant_test.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include <stdio.h>
#include <string>
#include <list>
#include <boost/array.hpp>
#include <boost/variant.hpp>
typedef boost::variant<int,long,double, const char*, _int64, std::string*, boost::array<int,128>*> tVarinat;
int main ()
{
tVarinat v;
std::list<int> l;
printf( "size %d\n", sizeof( tVarinat ) );
printf( "size %d\n", sizeof( std::string ) );
printf( "size %d\n", sizeof( l ) );
printf( "size %d\n", sizeof( boost::array<int,128> ) );
return 0;
}

34
call_constructor.cpp Normal file
View File

@@ -0,0 +1,34 @@
#include <stdio.h>
class a
{
public:
a()
{
printf( "kuku\n" );
}
~a()
{
printf( "~a\n" );
}
int f()
{
return 0;
}
};
int main()
{
a o;
// o.a( 0 );
o.~a();
o.f();
reinterpret_cast<a*>(0)->a::a();
}

20
constStrType.cpp Normal file
View File

@@ -0,0 +1,20 @@
#include <stdio.h>
template <class T>
struct A
{
int f ( T t )
{
//T b = "valod";
printf( "%s %d\n", t, sizeof( t ) );
return sizeof( t );
}
};
int main ( void )
{
A<char*> o;
o.f( "abc" );
return 0;
}

19
dlload.cpp Normal file
View File

@@ -0,0 +1,19 @@
#include <dlfcn.h>
#include <stdio.h>
int main ()
{
// void* h1 = dlopen( "/home/vishap/p4/wb/main/stage-g/lib/amd64/libProteus.so", RTLD_LAZY|RTLD_GLOBAL);
void* h1 = dlopen( "/home/vishap/p4/wb/main/stage-g/lib/amd64/libProteus.so", RTLD_NOW|RTLD_GLOBAL);
if ( !h1 ) puts( dlerror() );
printf( "handle1 = 0x%x\n", h1 );
void* h2 = dlopen( "/home/vishap/p4/wb/main/src/icwb/test/libProteus.so", RTLD_LAZY|RTLD_GLOBAL);
if ( !h2 ) puts( dlerror() );
printf( "handle2 = 0x%x\n", h2 );
dlclose(h1);
dlclose(h2);
return 0;
}

46
dyn_cast.cpp Normal file
View File

@@ -0,0 +1,46 @@
#include <stdio.h>
class A
{
public: virtual void* getThis()
{ return this; }
};
class B : virtual public A
{
public: virtual void* getThis()
{ return this; }
public: virtual void printB()
{ puts("B"); }
};
class C : virtual public A
{
public: virtual void* getThis()
{ return this; }
public: virtual void printC()
{ puts("C"); }
};
class D : public B,
public C
{
public: virtual void* getThis()
{ return this; }
};
int main ()
{
D o;
B* pB = reinterpret_cast<B*>( o.getThis() );
C* pC = reinterpret_cast<C*>( o.getThis() );
pB->printB();
pC->printC();
return 0;
}

View File

@@ -0,0 +1,18 @@
#include <stdlib.h>
#include "external_guard_time100000.h"
#include "external_guard_time100000.h"
#include "external_guard_time100000.h"
#include "external_guard_time100000.h"
#include "external_guard_time100000.h"
#include "external_guard_time100000.h"
#include "external_guard_time100000.h"
#include "external_guard_time100000.h"
#include "external_guard_time100000.h"
#include "external_guard_time100000.h"
int main ()
{
return 0;
}

View File

@@ -0,0 +1,42 @@
#ifndef _EXT__H_
#include <stdlib.h>
#endif
#ifndef _EXT__H_
#include <stdlib.h>
#endif
#ifndef _EXT__H_
#include <stdlib.h>
#endif
#ifndef _EXT__H_
#include <stdlib.h>
#endif
#ifndef _EXT__H_
#include <stdlib.h>
#endif
#ifndef _EXT__H_
#include <stdlib.h>
#endif
#ifndef _EXT__H_
#include <stdlib.h>
#endif
#ifndef _EXT__H_
#include <stdlib.h>
#endif
#ifndef _EXT__H_
#include <stdlib.h>
#endif
#ifndef _EXT__H_
#include <stdlib.h>
#endif

View File

@@ -0,0 +1,13 @@
#include "external_guard_time10.h"
#include "external_guard_time10.h"
#include "external_guard_time10.h"
#include "external_guard_time10.h"
#include "external_guard_time10.h"
#include "external_guard_time10.h"
#include "external_guard_time10.h"
#include "external_guard_time10.h"
#include "external_guard_time10.h"
#include "external_guard_time10.h"

View File

@@ -0,0 +1,11 @@
#include "external_guard_time100.h"
#include "external_guard_time100.h"
#include "external_guard_time100.h"
#include "external_guard_time100.h"
#include "external_guard_time100.h"
#include "external_guard_time100.h"
#include "external_guard_time100.h"
#include "external_guard_time100.h"
#include "external_guard_time100.h"
#include "external_guard_time100.h"

View File

@@ -0,0 +1,11 @@
#include "external_guard_time1000.h"
#include "external_guard_time1000.h"
#include "external_guard_time1000.h"
#include "external_guard_time1000.h"
#include "external_guard_time1000.h"
#include "external_guard_time1000.h"
#include "external_guard_time1000.h"
#include "external_guard_time1000.h"
#include "external_guard_time1000.h"
#include "external_guard_time1000.h"

View File

@@ -0,0 +1,11 @@
#include "external_guard_time10000.h"
#include "external_guard_time10000.h"
#include "external_guard_time10000.h"
#include "external_guard_time10000.h"
#include "external_guard_time10000.h"
#include "external_guard_time10000.h"
#include "external_guard_time10000.h"
#include "external_guard_time10000.h"
#include "external_guard_time10000.h"
#include "external_guard_time10000.h"

329
getcurrenttime.h Normal file
View 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
}

287
getcurrenttime2.h Normal file
View File

@@ -0,0 +1,287 @@
//
// Use "rdtsc" to mesure performance.
//
//
#ifndef __PERFORMANCE__H__
#define __PERFORMANCE__H__
#include <fstream>
#include <iostream>
#include <limits>
#include <math.h>
#include <map>
#if defined( WIN32 )
#undef min
#undef max
#endif
#if defined( WIN32 )
#define QUERY_PERFORMANCE_COUNTER
#define RDTSC
#else
#define GET_TIME_OF_DAY
#endif
#if defined( RDTSC )
#include <windows.h>
class perf
{
__int64 beginning;
static double frequency;
__forceinline __int64 getCurrentTime()
{
__asm
{
//
// Read the time stamp counter.
//
rdtsc
}
}
public:
__forceinline perf()
{
// ::Sleep( 0 );
//
// Serialized instruction ensure all previouse
// instructions a done befor reading the performance
// counter.
//
__asm xor eax,eax
__asm cpuid
beginning = getCurrentTime();
// __asm xor eax,eax
// __asm cpuid
}
__forceinline double elapsed()
{
__int64 now = getCurrentTime();
return double(now - beginning - 60 ) / frequency;
}
static void init()
{
//
// 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.
// Temporaily put 1.
//
frequency = 1.;
}
};
double perf::frequency;
#elif defined( QUERY_PERFORMANCE_COUNTER )
#include <windows.h>
class perf
{
__int64 beginning;
static double frequency;
__forceinline __int64 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 tc;
QueryPerformanceCounter(
reinterpret_cast<LARGE_INTEGER*>( &tc )
);
return tc;
}
public:
__forceinline perf()
{
// ::Sleep( 0 );
beginning = getCurrentTime();
}
__forceinline double elapsed()
{
__int64 now = getCurrentTime();
return double(now - beginning ); // frequency;
}
static void init()
{
//
// 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 pf;
QueryPerformanceFrequency(
reinterpret_cast<LARGE_INTEGER*>( &pf )
);
//
// Get the frequency.
//
frequency = double(pf);
}
};
double perf::frequency;
#elif defined ( GET_TIME_OF_DAY )
#include <sys/time.h>
class perf
{
timeval beginning;
public:
__forceinline perf()
{
gettimeofday(&beginning,0);
}
__forceinline double elapsed()
{
timeval now;
gettimeofday(&now,0);
return double(now.tv_sec) - double(beginning.tv_sec)
+ (double(now.tv_usec)-double(beginning.tv_usec))/1000000.0;
}
static void init()
{
}
};
#endif
template<class F >
double mesure( F& fnctr, int nProbes = 100000, bool bPrint = false )
{
typedef std::map<double,int> probs_type;
probs_type probs;
int n = 0;
for ( int i = 0; i < nProbes; ++i )
{
perf pc;
fnctr();
double m = pc.elapsed();
n = ++probs[ m ];
}
double m;
n = 0;
for ( probs_type::iterator it = probs.begin();
it != probs.end();
++it )
{
if ( it->second > n )
{
n = it->second;
m = it->first;
}
}
if ( bPrint )
{
std::cout << "tsc=" << m << " probes=" << nProbes << std::endl;
std::cout << "===============================" << std::endl;
for ( probs_type::iterator it = probs.begin();
it != probs.end();
++it )
std::cout << "prob=" << it->first << "\t amount=" << it->second << std::endl;
}
return m;
};
struct nop
{
__forceinline void operator() ()
{
}
};
void perf_init()
{
perf::init();
mesure<nop>( nop(), 100000, true );
#if 0
typedef std::map<double,int> probs_type;
probs_type probs;
double m = 1e300;
double s = 0;
int i_last = 0;
int i = 0;
int n = 0;
double c;
for ( ; n < 1000000; ++i )
{
perf pc;
c = pc.elapsed();
n = ++probs[ c ];
}
std::cout << "tsc=" << c << " probes=" << i << std::endl;
std::cout << "=========================" << std::endl;
for ( probs_type::iterator it = probs.begin();
it != probs.end();
++it )
{
std::cout << "prob=" << it->first << "\t amount=" << it->second << std::endl;
}
#endif
}
#endif//__PERFORMANCE__H__

20
libgd_test/libgd_test.sln Normal file
View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgd_test", "libgd_test.vcproj", "{B0DC9AC9-CE8C-422D-B67B-57F4593B1BC8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B0DC9AC9-CE8C-422D-B67B-57F4593B1BC8}.Debug|Win32.ActiveCfg = Debug|Win32
{B0DC9AC9-CE8C-422D-B67B-57F4593B1BC8}.Debug|Win32.Build.0 = Debug|Win32
{B0DC9AC9-CE8C-422D-B67B-57F4593B1BC8}.Release|Win32.ActiveCfg = Release|Win32
{B0DC9AC9-CE8C-422D-B67B-57F4593B1BC8}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libgd_test"
ProjectGUID="{B0DC9AC9-CE8C-422D-B67B-57F4593B1BC8}"
RootNamespace="libgd_test"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="D:\work\src\gd-2.0.35_dev\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="bgdd.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="D:\work\src\gd-2.0.35_dev\lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

10
long_long_size.cpp Normal file
View File

@@ -0,0 +1,10 @@
#include <iostream>
int main ( void )
{
std::cout << "sizeof(long) = " << sizeof( long ) << std::endl;
std::cout << "sizeof(long long) = " << sizeof( long long ) << std::endl;
return 0;
}

View File

@@ -0,0 +1,40 @@
// mergeTwoFiles.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
FILE* f1 = fopen( "D:\\tmp\\pf.avi", "rb" );
FILE* f2 = fopen( "D:\\tmp\\PulpFiction2.avi", "rb" );
FILE* o = fopen( "D:\\tmp\\aaaa.avi", "wb" );
char buf[2048];
for ( ; !feof( f1 ); )
{
int n = fread( buf, 1, sizeof( buf ), f1 );
if ( !n )
break;
bool b = false;
for ( int i = 0; !b && i < n; ++i )
if ( buf[i] )
b = true;
if ( !b )
{
int pos = ftell( f1 );
fseek( f2, pos, SEEK_SET );
n = fread( buf, 1, sizeof( buf ), f2 );
}
fwrite( buf, 1, n, o );
}
fclose( o );
fclose( f1 );
fclose( f2 );
return 0;
}

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mergeTwoFiles", "mergeTwoFiles.vcproj", "{F07269AD-FE36-43E5-A832-92D5FC475DE2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F07269AD-FE36-43E5-A832-92D5FC475DE2}.Debug|Win32.ActiveCfg = Debug|Win32
{F07269AD-FE36-43E5-A832-92D5FC475DE2}.Debug|Win32.Build.0 = Debug|Win32
{F07269AD-FE36-43E5-A832-92D5FC475DE2}.Release|Win32.ActiveCfg = Release|Win32
{F07269AD-FE36-43E5-A832-92D5FC475DE2}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mergeTwoFiles"
ProjectGUID="{F07269AD-FE36-43E5-A832-92D5FC475DE2}"
RootNamespace="mergeTwoFiles"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\mergeTwoFiles.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

8
mergeTwoFiles/stdafx.cpp Normal file
View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// mergeTwoFiles.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

17
mergeTwoFiles/stdafx.h Normal file
View File

@@ -0,0 +1,17 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

66
openMP_simple_test.cpp Normal file
View File

@@ -0,0 +1,66 @@
// toIntTest.cpp : Defines the entry point for the console application.
//
#include <omp.h>
#include <stdio.h>
#include "getCurrentTime.h"
#include "../fw/2007.12/src/base/point.h"
#if !defined(__AIX) && !defined(__sparc)
#define LOW_ENDIAN_ARCH
#endif
#ifdef _MSC_VER
#define MY_INLINE __forceinline
#else
#define MY_INLINE inline
#endif
#ifndef _MSC_VER
#define __int64 long
#endif
void test1()
{
int th_id, nthreads;
#pragma omp parallel private(th_id)
{
th_id = omp_get_thread_num();
printf("Hello World from thread %d\n", th_id);
#pragma omp barrier
if ( th_id == 0 )
{
nthreads = omp_get_num_threads();
printf("There are %d threads\n",nthreads);
}
}
}
void test2()
{
int th_id, nthreads;
#pragma omp parallel private(th_id)
{
th_id = omp_get_thread_num();
printf("Hello World from thread %d\n", th_id);
// #pragma omp barrier
if ( th_id == 0 )
{
nthreads = omp_get_num_threads();
printf("There are %d threads\n",nthreads);
}
}
}
int main(int argc, char* argv[])
{
// Init
initGetCurrentTimeLib();
// test1();
test2();
return 0;
}

213
pnginfo/pnginfo.cpp Normal file
View File

@@ -0,0 +1,213 @@
// pnginfo.cpp : Defines the entry point for the console application.
//
#include <exception>
#include <iostream>
#include <boost/format.hpp>
#include <png.h>
#include <pngstruct.h>
static void error_handler(png_structp png_ptr, png_const_charp msg)
{
// if (png_ptr)
// ;
throw std::logic_error( boost::str(boost::format("libpng: %1") % msg).c_str() );
}
static void warning_handler(png_structp png_ptr, png_const_charp msg)
{
// if (png_ptr)
// ;
std::cerr << "Warning: libpng: " << msg << std::endl;
}
void print_info( const std::string& name )
{
png_structp png_ptr = 0;
png_infop info_ptr = 0;
try
{
//
// Open the file.
//
FILE * file = fopen( name.c_str(), "rb");
if ( !file )
throw std::logic_error( "fopen failed." );
//
// First check the eight byte PNG signature.
//
png_byte signature[8];
fread(signature, 1, 8, file);
if (png_sig_cmp(signature, 0, 8))
throw std::logic_error( "Bad signature." );
//
// Create the two png(-info) structures.
//
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
0/*this*/,
(png_error_ptr)error_handler,
(png_error_ptr)warning_handler);
if (!png_ptr)
throw std::logic_error( "png_create_read_struct failed." );
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
throw std::logic_error( "png_create_info_struct failed." );
//
// Initialize the png structure.
//
png_init_io(png_ptr, file);
png_set_sig_bytes(png_ptr, 8);
//
// Read all PNG info up to image data.
//
png_read_info(png_ptr, info_ptr);
//
// Get width, height, bit-depth and color-type.
//
png_uint_32 width;
png_uint_32 height;
int bitDepth;
int colorType;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bitDepth,
&colorType, NULL, NULL, NULL);
png_size_t rowBytes = png_get_rowbytes(png_ptr, info_ptr);
int channels = png_get_channels(png_ptr, info_ptr);
std::string colorTypeStr;
switch ( colorType )
{
case PNG_COLOR_TYPE_GRAY:
colorTypeStr = "PNG_COLOR_TYPE_GRAY";
break;
case PNG_COLOR_TYPE_GRAY_ALPHA:
colorTypeStr = "PNG_COLOR_TYPE_GRAY_ALPHA";
break;
case PNG_COLOR_TYPE_PALETTE:
colorTypeStr = "PNG_COLOR_TYPE_PALETTE";
break;
case PNG_COLOR_TYPE_RGB:
colorTypeStr = "PNG_COLOR_TYPE_RGB";
break;
case PNG_COLOR_TYPE_RGB_ALPHA:
colorTypeStr = "PNG_COLOR_TYPE_RGB_ALPHA";
break;
default:
colorTypeStr = boost::str( boost::format( "%02x" ) % colorType );
}
std::cout << "Name: " << name << std::endl;
std::cout << "Width: " << width << std::endl;
std::cout << "Height: " << height << std::endl;
std::cout << "Bit Depth: " << bitDepth << std::endl;
std::cout << "Channels: " << channels << std::endl;
std::cout << "Color Type: " << colorTypeStr << std::endl;
#if 0
//
// Expand images of all color-type and bit-depth to 3x8-bit RGB.
// let the library process alpha, transparency, background, etc.
//
if (colorType == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr);
if (bitDepth < 8)
png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_expand(png_ptr);
if (colorType == PNG_COLOR_TYPE_GRAY ||
colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr);
if (colorType == PNG_COLOR_TYPE_RGB_ALPHA ||
colorType == PNG_COLOR_TYPE_GRAY_ALPHA ||
png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) )
png_set_swap_alpha(png_ptr);
else
png_set_filler(png_ptr, ~0, PNG_FILLER_BEFORE);
if (bitDepth == 16)
# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
png_set_scale_16(png_ptr);
# else
png_set_strip_16(png_ptr);
# endif
//
// Set the background color to draw transparent and alpha images over.
//
png_color_16 * bg16;
if (png_get_bKGD(png_ptr, info_ptr, &bg16))
png_set_background(png_ptr, bg16, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
//
// If required set gamma conversion.
//
double dGamma;
if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
png_set_gamma(png_ptr, (double) 2.2, dGamma);
//
// After the transformations are registered, update info_ptr data.
//
png_read_update_info(png_ptr, info_ptr);
//
// Get again width, height and the new bit-depth and color-type.
//
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bitDepth, &colorType, 0, 0, 0);
//
// Row_bytes is the width x number of channels.
//
if ( rowBytes != channels * width * bitDepth / 8 )
throw std::logic_error( "row bytes is not equal to channels*width*bitDepth/8" );
//
// Check if the image can store data.
//
if ( I::bit_depth != bitDepth )
throw std::logic_error( "bit depth don't match." );
if ( I::channels != channels )
throw std::logic_error( "channels don't match." );
//
// Now we can allocate memory to store the image.
//
image.resize( width, height );
//
// Read data raw by raw.
//
for (png_uint_32 i = 0; i < height; i++)
png_read_row( png_ptr, (png_bytep)image.getData( 0, i ), 0 );
//
// Read the additional chunks in the PNG file (not really needed).
//
png_read_end(png_ptr, 0);
#endif
//
// Destroy reader and info.
//
png_destroy_read_struct( &png_ptr, &info_ptr, 0 );
png_ptr = 0;
info_ptr = 0;
}
catch ( ... )
{
if ( png_ptr )
png_destroy_read_struct( &png_ptr, &info_ptr, 0 );
throw;
}}
int main(int argc, char * argv[])
{try{
if ( argc != 2 )
{
std::cerr << "Usage: " << argv[0] << " <png file name>" << std::endl;
return 3;
}
print_info(argv[1]);
return 0;
}
catch ( const std::exception& e )
{
std::cerr << "Error: " << e.what() << std::endl;
return 2;
}
catch (...)
{
std::cerr << "Error: unknown." << std::endl;
return 1;
}}

155
pnginfo/pnginfo.vcxproj Normal file
View File

@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{248F64F5-D206-4134-A85A-7C919EE88B50}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>pnginfo</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\Users\Vahagnk\src\libpng-1.5.10;C:\Users\Vahagnk\src\zlib-1.2.6;C:\Users\Vahagnk\src\boost_1_48_0;C:\Users\Vahagnk\src\gtest-1.6.0\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libpngd.lib;zlibd.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Users\Vahagnk\src\libpng-1.5.10;C:\Users\Vahagnk\src\zlib-1.2.6;%(AdditionalLibraryDirectories);C:\Users\Vahagnk\src\gtest-1.6.0</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions); _CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\Users\Vahagnk\src\libpng-1.5.10;C:\Users\Vahagnk\src\zlib-1.2.6;C:\Users\Vahagnk\src\boost_1_48_0;C:\Users\Vahagnk\src\gtest-1.6.0\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libpngd.lib;zlibd.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Users\Vahagnk\src\libpng-1.5.10;C:\Users\Vahagnk\src\zlib-1.2.6;%(AdditionalLibraryDirectories);C:\Users\Vahagnk\src\gtest-1.6.0</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\Users\Vahagnk\src\libpng-1.5.10;C:\Users\Vahagnk\src\zlib-1.2.6;C:\Users\Vahagnk\src\boost_1_48_0;C:\Users\Vahagnk\src\gtest-1.6.0\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libpng.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Users\Vahagnk\src\libpng-1.5.10;C:\Users\Vahagnk\src\zlib-1.2.6;%(AdditionalLibraryDirectories);C:\Users\Vahagnk\src\gtest-1.6.0</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions); _CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\Users\Vahagnk\src\libpng-1.5.10;C:\Users\Vahagnk\src\zlib-1.2.6;C:\Users\Vahagnk\src\boost_1_48_0;C:\Users\Vahagnk\src\gtest-1.6.0\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);libpng.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Users\Vahagnk\src\libpng-1.5.10;C:\Users\Vahagnk\src\zlib-1.2.6;%(AdditionalLibraryDirectories);C:\Users\Vahagnk\src\gtest-1.6.0</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="pnginfo.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pnginfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

17
shift_size.cpp Normal file
View File

@@ -0,0 +1,17 @@
#include <iostream>
#include <iomanip>
int main ( )
{
std::cout << "shift amount: ";
int a;
std::cin >> a;
int b = 1;
int c = b << a;
std::cout << " 1 << " << a << " = " << std::hex << c << std::endl;
return 0;
}

20
sln/SEE_test/SEE_test.sln Normal file
View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SEE_test", "SEE_test.vcproj", "{CD622CAF-1FB7-4E6B-8130-89A4B8A2AD8A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CD622CAF-1FB7-4E6B-8130-89A4B8A2AD8A}.Debug|Win32.ActiveCfg = Debug|Win32
{CD622CAF-1FB7-4E6B-8130-89A4B8A2AD8A}.Debug|Win32.Build.0 = Debug|Win32
{CD622CAF-1FB7-4E6B-8130-89A4B8A2AD8A}.Release|Win32.ActiveCfg = Release|Win32
{CD622CAF-1FB7-4E6B-8130-89A4B8A2AD8A}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,263 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="SEE_test"
ProjectGUID="{CD622CAF-1FB7-4E6B-8130-89A4B8A2AD8A}"
RootNamespace="SEE_test"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="D:\Synopsys\p4\fw\main\src\;&quot;C:\Program Files\boost_1_35_0&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="D:\Synopsys\p4\fw\main\src\;&quot;C:\Program Files\boost_1_35_0&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\SSE_transform.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\SSE_cmplr_abstraction.h"
>
</File>
<File
RelativePath="..\..\SSE_cmplr_abstraction_GCC.h"
>
</File>
<File
RelativePath="..\..\SSE_cmplr_abstraction_MSC.h"
>
</File>
<File
RelativePath="..\..\SSE_cmplr_abstraction_MSC_pckdbl.h"
>
</File>
<File
RelativePath="..\..\SSE_cmplr_abstraction_MSC_pckfloat.h"
>
</File>
<File
RelativePath="..\..\SSE_cmplr_abstraction_MSC_pckint16.h"
>
</File>
<File
RelativePath="..\..\SSE_cmplr_abstraction_MSC_pckint32.h"
>
</File>
<File
RelativePath="..\..\SSE_cmplr_abstraction_MSC_pckint64.h"
>
</File>
<File
RelativePath="..\..\SSE_cmplr_abstraction_MSC_pckint8.h"
>
</File>
<File
RelativePath="..\..\SSE_cmplr_abstraction_other.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="base_transform"
>
<File
RelativePath="..\..\..\fw\main\src\base\transform.cpp"
>
</File>
<File
RelativePath="..\..\..\fw\main\src\base\transform.h"
>
</File>
</Filter>
<Filter
Name="my_transform"
>
<File
RelativePath="..\..\SSE2_transform.cpp"
>
</File>
<File
RelativePath="..\..\SSE2_transform.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WindowsApplication1", "WindowsApplication1.vbproj", "{E5DFDA7A-4D1A-446E-A316-2ABF82859657}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E5DFDA7A-4D1A-446E-A316-2ABF82859657}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5DFDA7A-4D1A-446E-A316-2ABF82859657}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5DFDA7A-4D1A-446E-A316-2ABF82859657}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5DFDA7A-4D1A-446E-A316-2ABF82859657}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "any_const_hides_copy_const", "any_const_hides_copy_const\any_const_hides_copy_const.vcproj", "{C73246A3-C434-444A-9490-7C3AAD72C099}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C73246A3-C434-444A-9490-7C3AAD72C099}.Debug|Win32.ActiveCfg = Debug|Win32
{C73246A3-C434-444A-9490-7C3AAD72C099}.Debug|Win32.Build.0 = Debug|Win32
{C73246A3-C434-444A-9490-7C3AAD72C099}.Release|Win32.ActiveCfg = Release|Win32
{C73246A3-C434-444A-9490-7C3AAD72C099}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="any_const_hides_copy_const"
ProjectGUID="{C73246A3-C434-444A-9490-7C3AAD72C099}"
RootNamespace="any_const_hides_copy_const"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\any_const_hides_copy_const.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_variant_test", "boost_variant_test.vcproj", "{6A52DAA3-54D4-4929-867F-F268F087F518}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6A52DAA3-54D4-4929-867F-F268F087F518}.Debug|Win32.ActiveCfg = Debug|Win32
{6A52DAA3-54D4-4929-867F-F268F087F518}.Debug|Win32.Build.0 = Debug|Win32
{6A52DAA3-54D4-4929-867F-F268F087F518}.Release|Win32.ActiveCfg = Release|Win32
{6A52DAA3-54D4-4929-867F-F268F087F518}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,199 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="boost_variant_test"
ProjectGUID="{6A52DAA3-54D4-4929-867F-F268F087F518}"
RootNamespace="boost_variant_test"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;C:\Program Files\boost_1_35_0\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;C:\Program Files\boost_1_35_0\&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\boost_variant_test.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openMpSimpleTest", "openMpSimpleTest.vcproj", "{5F1F3ED8-2682-4901-83CE-83D545D0D68B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
PseudoDebug|Win32 = PseudoDebug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5F1F3ED8-2682-4901-83CE-83D545D0D68B}.Debug|Win32.ActiveCfg = Debug|Win32
{5F1F3ED8-2682-4901-83CE-83D545D0D68B}.Debug|Win32.Build.0 = Debug|Win32
{5F1F3ED8-2682-4901-83CE-83D545D0D68B}.PseudoDebug|Win32.ActiveCfg = PseudoDebug|Win32
{5F1F3ED8-2682-4901-83CE-83D545D0D68B}.PseudoDebug|Win32.Build.0 = PseudoDebug|Win32
{5F1F3ED8-2682-4901-83CE-83D545D0D68B}.Release|Win32.ActiveCfg = Release|Win32
{5F1F3ED8-2682-4901-83CE-83D545D0D68B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,290 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="openMpSimpleTest"
ProjectGUID="{5F1F3ED8-2682-4901-83CE-83D545D0D68B}"
RootNamespace="openMpSimpleTest"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="D:\Synopsys\p4\fw\main\src;D:\Synopsys\p4\test\OpenMPForVC2k5"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
OpenMP="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
AdditionalLibraryDirectories="D:\Synopsys\p4\test\OpenMPForVC2k5"
GenerateManifest="false"
AdditionalManifestDependencies=""
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
AllowIsolation="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
EmbedManifest="false"
VerboseOutput="true"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="D:\Synopsys\p4\fw\main\src;D:\Synopsys\p4\test\OpenMPForVC2k5"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
OpenMP="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
AdditionalLibraryDirectories="D:\Synopsys\p4\test\OpenMPForVC2k5"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
AllowIsolation="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="PseudoDebug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="D:\Synopsys\p4\fw\main\src;D:\Synopsys\p4\test\OpenMPForVC2k5"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
OpenMP="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
AdditionalLibraryDirectories="D:\Synopsys\p4\test\OpenMPForVC2k5"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="0"
EnableCOMDATFolding="0"
TargetMachine="1"
AllowIsolation="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\openMP_simple_test.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,60 @@
/****************************************************************************
** Meta object code from reading C++ file 'qstringdebug.h'
**
** Created: Fri May 30 00:05:16 2008
** by: The Qt Meta Object Compiler version 59 (Qt 4.3.3)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../../qstringdebug.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'qstringdebug.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
#error "This file was generated using the moc from 4.3.3. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
static const uint qt_meta_data_qstringDebug[] = {
// content:
1, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0 // eod
};
static const char qt_meta_stringdata_qstringDebug[] = {
"qstringDebug\0"
};
const QMetaObject qstringDebug::staticMetaObject = {
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_qstringDebug,
qt_meta_data_qstringDebug, 0 }
};
const QMetaObject *qstringDebug::metaObject() const
{
return &staticMetaObject;
}
void *qstringDebug::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_qstringDebug))
return static_cast<void*>(const_cast< qstringDebug*>(this));
return QMainWindow::qt_metacast(_clname);
}
int qstringDebug::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}

View File

@@ -0,0 +1,66 @@
/********************************************************************************
** Form generated from reading ui file 'qstringdebug.ui'
**
** Created: Fri May 30 00:05:11 2008
** by: Qt User Interface Compiler version 4.3.3
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
********************************************************************************/
#ifndef UI_QSTRINGDEBUG_H
#define UI_QSTRINGDEBUG_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QMainWindow>
#include <QtGui/QMenuBar>
#include <QtGui/QStatusBar>
#include <QtGui/QToolBar>
#include <QtGui/QWidget>
class Ui_qstringDebugClass
{
public:
QMenuBar *menuBar;
QToolBar *mainToolBar;
QWidget *centralWidget;
QStatusBar *statusBar;
void setupUi(QMainWindow *qstringDebugClass)
{
if (qstringDebugClass->objectName().isEmpty())
qstringDebugClass->setObjectName(QString::fromUtf8("qstringDebugClass"));
qstringDebugClass->resize(600, 400);
menuBar = new QMenuBar(qstringDebugClass);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
qstringDebugClass->setMenuBar(menuBar);
mainToolBar = new QToolBar(qstringDebugClass);
mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
qstringDebugClass->addToolBar(mainToolBar);
centralWidget = new QWidget(qstringDebugClass);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
qstringDebugClass->setCentralWidget(centralWidget);
statusBar = new QStatusBar(qstringDebugClass);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
qstringDebugClass->setStatusBar(statusBar);
retranslateUi(qstringDebugClass);
QMetaObject::connectSlotsByName(qstringDebugClass);
} // setupUi
void retranslateUi(QMainWindow *qstringDebugClass)
{
qstringDebugClass->setWindowTitle(QApplication::translate("qstringDebugClass", "qstringDebug", 0, QApplication::UnicodeUTF8));
Q_UNUSED(qstringDebugClass);
} // retranslateUi
};
namespace Ui {
class qstringDebugClass: public Ui_qstringDebugClass {};
} // namespace Ui
#endif // UI_QSTRINGDEBUG_H

11
sln/qstringDebug/main.cpp Normal file
View File

@@ -0,0 +1,11 @@
#include <QtGui/QApplication>
#include "qstringdebug.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qstringDebug w;
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}

View File

@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qstringDebug", "qstringDebug.vcproj", "{A1511B5B-670F-4CB4-83D4-F9E66868E48B}"
GlobalSection(Qt) = preSolution
Integration = True
EndGlobalSection
EndProject
Global
GlobalSection(Qt) = preSolution
Integration = True
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A1511B5B-670F-4CB4-83D4-F9E66868E48B}.Debug|Win32.ActiveCfg = Debug|Win32
{A1511B5B-670F-4CB4-83D4-F9E66868E48B}.Debug|Win32.Build.0 = Debug|Win32
{A1511B5B-670F-4CB4-83D4-F9E66868E48B}.Release|Win32.ActiveCfg = Release|Win32
{A1511B5B-670F-4CB4-83D4-F9E66868E48B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,343 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="qstringDebug"
ProjectGUID="{A1511B5B-670F-4CB4-83D4-F9E66868E48B}"
Keyword="Qt4VSv1.0"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui"
PreprocessorDefinitions="UNICODE,WIN32,QT_NO_DEBUG,NDEBUG,QT_CORE_LIB,QT_GUI_LIB"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="false"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib msimg32.lib shell32.lib kernel32.lib uuid.lib advapi32.lib qtmain.lib QtCore.lib QtGui.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories="$(QTDIR)\lib"
GenerateDebugInformation="false"
SubSystem="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui"
PreprocessorDefinitions="UNICODE,WIN32,QT_CORE_LIB,QT_GUI_LIB"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib msimg32.lib shell32.lib kernel32.lib uuid.lib advapi32.lib qtmaind.lib QtCored4.lib QtGuid4.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories="$(QTDIR)\lib"
GenerateDebugInformation="true"
SubSystem="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;cxx;c;def"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\qstringdebug.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\qstringdebug.h"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Moc&apos;ing qstringdebug.h..."
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -I&quot;.\GeneratedFiles&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; &quot;.\qstringdebug.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_qstringdebug.cpp&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;.\qstringdebug.h"
Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_qstringdebug.cpp&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Moc&apos;ing qstringdebug.h..."
CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -DUNICODE -DWIN32 -DQT_CORE_LIB -DQT_GUI_LIB -I&quot;.\GeneratedFiles&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; &quot;.\qstringdebug.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_qstringdebug.cpp&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;.\qstringdebug.h"
Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_qstringdebug.cpp&quot;"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Form Files"
Filter="ui"
UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"
>
<File
RelativePath=".\qstringdebug.ui"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Uic&apos;ing $(InputPath)..."
CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_qstringdebug.h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(QTDIR)\bin\uic.exe"
Outputs="&quot;.\GeneratedFiles\ui_qstringdebug.h&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Uic&apos;ing $(InputPath)..."
CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_qstringdebug.h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="$(QTDIR)\bin\uic.exe"
Outputs="&quot;.\GeneratedFiles\ui_qstringdebug.h&quot;"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="qrc;*"
UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
ParseFiles="false"
>
<File
RelativePath=".\qstringdebug.qrc"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""
AdditionalDependencies=""
Outputs=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""
AdditionalDependencies=""
Outputs=""
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Generated Files"
Filter="moc;h;cpp"
UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
SourceControlFiles="false"
>
<File
RelativePath=".\GeneratedFiles\Debug\moc_qstringdebug.cpp"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\GeneratedFiles\Release\moc_qstringdebug.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\GeneratedFiles\ui_qstringdebug.h"
>
</File>
</Filter>
</Files>
<Globals>
<Global
Name="MocDir"
Value=".\GeneratedFiles\$(ConfigurationName)"
/>
<Global
Name="QtVersion"
Value="4.3.3_Ekki"
/>
<Global
Name="RccDir"
Value=".\GeneratedFiles"
/>
<Global
Name="UicDir"
Value=".\GeneratedFiles"
/>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,14 @@
#include "qstringdebug.h"
qstringDebug::qstringDebug(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
ui.setupUi(this);
QString str = "kukukuku";
}
qstringDebug::~qstringDebug()
{
}

View File

@@ -0,0 +1,19 @@
#ifndef QSTRINGDEBUG_H
#define QSTRINGDEBUG_H
#include <QtGui/QMainWindow>
#include "ui_qstringdebug.h"
class qstringDebug : public QMainWindow
{
Q_OBJECT
public:
qstringDebug(QWidget *parent = 0, Qt::WFlags flags = 0);
~qstringDebug();
private:
Ui::qstringDebugClass ui;
};
#endif // QSTRINGDEBUG_H

View File

@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "std_vs_qt", "std_vs_qt.vcproj", "{41F5283C-3803-4436-8116-4133A5780B81}"
GlobalSection(Qt) = preSolution
Integration = True
EndGlobalSection
EndProject
Global
GlobalSection(Qt) = preSolution
Integration = True
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{41F5283C-3803-4436-8116-4133A5780B81}.Debug|Win32.ActiveCfg = Debug|Win32
{41F5283C-3803-4436-8116-4133A5780B81}.Debug|Win32.Build.0 = Debug|Win32
{41F5283C-3803-4436-8116-4133A5780B81}.Release|Win32.ActiveCfg = Release|Win32
{41F5283C-3803-4436-8116-4133A5780B81}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,217 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="std_vs_qt"
ProjectGUID="{41F5283C-3803-4436-8116-4133A5780B81}"
Keyword="Qt4VSv1.0"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);;$(QTDIR)\include\QtCore"
PreprocessorDefinitions="UNICODE,WIN32,QT_NO_DEBUG,NDEBUG,QT_CORE_LIB"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="false"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib msimg32.lib shell32.lib kernel32.lib uuid.lib advapi32.lib qtmain.lib QtCore4.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories="$(QTDIR)\lib"
GenerateDebugInformation="false"
SubSystem="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);;$(QTDIR)\include\QtCore"
PreprocessorDefinitions="UNICODE,WIN32,QT_CORE_LIB"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib msimg32.lib shell32.lib kernel32.lib uuid.lib advapi32.lib qtmaind.lib QtCored4.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories="$(QTDIR)\lib"
GenerateDebugInformation="true"
SubSystem="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;cxx;c;def"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\std_vs_qt.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="qrc;*"
UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
ParseFiles="false"
>
</Filter>
<Filter
Name="Generated Files"
Filter="moc;h;cpp"
UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
SourceControlFiles="false"
>
</Filter>
</Files>
<Globals>
<Global
Name="MocDir"
Value=".\GeneratedFiles\$(ConfigurationName)"
/>
<Global
Name="QtVersion"
Value="4.3.3_Ekki"
/>
<Global
Name="RccDir"
Value=".\GeneratedFiles"
/>
<Global
Name="UicDir"
Value=".\GeneratedFiles"
/>
</Globals>
</VisualStudioProject>

20
sln/toIntTest.sln Normal file
View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "toIntTest", "toIntTest.vcproj", "{4A53E026-6A19-4687-9583-1BA2F787E1D1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4A53E026-6A19-4687-9583-1BA2F787E1D1}.Debug|Win32.ActiveCfg = Debug|Win32
{4A53E026-6A19-4687-9583-1BA2F787E1D1}.Debug|Win32.Build.0 = Debug|Win32
{4A53E026-6A19-4687-9583-1BA2F787E1D1}.Release|Win32.ActiveCfg = Release|Win32
{4A53E026-6A19-4687-9583-1BA2F787E1D1}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

205
sln/toIntTest.vcproj Normal file
View File

@@ -0,0 +1,205 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="toIntTest"
ProjectGUID="{4A53E026-6A19-4687-9583-1BA2F787E1D1}"
RootNamespace="toIntTest"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableEnhancedInstructionSet="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\toIntTest.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtual_method_ptr", "virtual_method_ptr.vcproj", "{E1F1366C-5734-4F02-8A1C-15B8A65512E6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E1F1366C-5734-4F02-8A1C-15B8A65512E6}.Debug|Win32.ActiveCfg = Debug|Win32
{E1F1366C-5734-4F02-8A1C-15B8A65512E6}.Debug|Win32.Build.0 = Debug|Win32
{E1F1366C-5734-4F02-8A1C-15B8A65512E6}.Release|Win32.ActiveCfg = Release|Win32
{E1F1366C-5734-4F02-8A1C-15B8A65512E6}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="virtual_method_ptr"
ProjectGUID="{E1F1366C-5734-4F02-8A1C-15B8A65512E6}"
RootNamespace="virtual_method_ptr"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\virtual_method_ptr.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,35 @@
class a
{
public:
int i;
public:
virtual void f()
{
i = 0;
}
};
class b : virtual public a
{
public:
virtual void f()
{
i = 1;
}
};
int main()
{
b o;
a* pA = &o;
b* pB = static_cast<b*>(pA);
return 0;
}

725
std_vs_qt.cpp Normal file
View File

@@ -0,0 +1,725 @@
#include <stdio.h>
#include "getCurrentTime.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QString>
#include <list>
#include <memory>
#include <string>
#if defined( _MSC_VER )
#pragma intrinsic (memcpy,memcmp,memset,strcat,strcmp,strcpy,strlen)
#endif
namespace constructor
{
void * operator new( size_t count,
void * object )
{
return object;
}
}
//#define ALLOC_AT_ONCE
//#define USE_MALLOC
// TEMPLATE CLASS allocator
template<class T, int N>
class fast_allocator
#ifndef USE_MALLOC
: public std::allocator<T>
#endif
{
char memory[N];
#ifndef ALLOC_AT_ONCE
char* marker;
#endif
public:
typedef std::allocator<T> MyBase;
typedef T value_type;
typedef value_type *pointer;
typedef value_type & reference;
typedef const value_type *const_pointer;
typedef const value_type & const_reference;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
template<class _Other>
struct rebind
{ // convert an allocator<_Ty> to an allocator <_Other>
typedef fast_allocator<_Other,N> other;
};
// return address of mutable _Val
pointer address(reference _Val) const
{
return (&_Val);
}
const_pointer address(const_reference _Val) const
{ // return address of nonmutable _Val
return (&_Val);
}
fast_allocator() throw()
#ifndef ALLOC_AT_ONCE
: marker( memory )
#endif
{}
// construct by copying (do nothing)
fast_allocator( const fast_allocator<T,N>& ) throw()
#ifndef ALLOC_AT_ONCE
: marker( memory )
#endif
{}
// construct from a related allocator (do nothing)
// template<class _Other>
// allocatorN(const std::allocator<_Other>&) throw()
// : marker( memory )
// {}
// deallocate object at _Ptr, ignore size
void deallocate(pointer p, size_type n )
{
#ifdef ALLOC_AT_ONCE
if ( p != static_cast<pointer>(memory) )
#ifdef USE_MALLOC
free( p );
#else
return MyBase::deallocate( p, n );
#endif
#else/*ALLOC_AT_ONCE*/
if ( p+n == marker )
marker = p;
else if ( p < static_cast<pointer>(memory)
|| static_cast<pointer>(&memory[N]) <= p )
#ifdef USE_MALLOC
free( p );
#else
return MyBase::deallocate( p, n );
#endif
#endif
}
// allocate array of n elements
pointer allocate(size_type nCount)
{
register size_type s = sizeof(T)*nCount;
#ifdef ALLOC_AT_ONCE
if ( sizeof(T)*nCount < N )
return static_cast<pointer>(memory);
#else
if ( sizeof(T)*nCount < (&memory[N] - marker) )
{
pointer p = static_cast<pointer>(marker);
marker += s;
return p;
}
#endif
else
#ifdef USE_MALLOC
return static_cast<char*>(malloc( s ));
#else
return MyBase::allocate( nCount );
#endif
}
// allocate array of n elements, ignore hint
pointer allocate(size_type nCount, const void *)
{
return allocate(nCount);
}
// construct object at _Ptr with value _Val
void construct(pointer _Ptr, const T& _Val)
{
::new (_Ptr) T(_Val);
}
// destroy object at _Ptr
void destroy( pointer p )
{
p->~T();
}
// estimate maximum array size
size_type max_size() const throw()
{
#ifdef USE_MALLOC
return (size_type)(-1) / sizeof(T);
#else
// return MyBase::max_size();
return (int)(-1) / sizeof(T);
#endif
}
// bool operator( const fast_allocator& op )
// {
// return &op == this;
// }
};
template <class T, int N>
inline
bool operator== ( const fast_allocator<T,N>& op1,
const fast_allocator<T,N>& op2 )
{
return &op1 == &op2;
}
// STRUCT char_traits<char> (FROM <string>)
template<class C>
struct fast_char_traits
{ // properties of a string or stream char element
typedef C char_type;
typedef int int_type;
typedef std::streampos pos_type;
typedef std::streamoff off_type;
// typedef _Mbstatet state_type;
// assign an element
static void assign( char_type& l, const char_type& r)
{
l = r;
}
// test for element equality
static bool eq( const char_type& l, const char_type& r)
{
return (l == r);
}
// test if l precedes r
static bool lt( const char_type& l, const char_type& r)
{
return (l < r);
}
// compare [_First1, _First1 + n) with [_First2, ...)
static int compare(const char_type *op1, const char_type *op2, size_t n)
{
return (::memcmp(op1, op2, n*sizeof(char_type)));
}
// find length of null-terminated string
static size_t length(const char_type * op)
{
return (::strlen(op));
}
// assume there is enough space in the destination buffer
static char_type * copy(char_type *dest, const char_type *src, size_t n)
{
return reinterpret_cast<char_type*>(::memcpy( dest, src, n*sizeof(char_type) ));
}
// look for _Ch in [_First, _First + n)
static const char_type * find(const char_type * src, size_t n, const char_type& ch)
{
return ((const char_type *)::memchr(src, ch, n));
}
// move [_First1, _First1 + n) to [_First2, ...)
// assume there is enough space in the destination buffer
static char_type * move(char_type *dest, const char_type *src, size_t n)
{
return reinterpret_cast<char_type*>(::memmove(dest, src, n*sizeof(char_type)));
}
// assign n * _Ch to [_First, ...)
static char_type * assign(char_type *_First, size_t n, char_type _Ch)
{
return ((char_type *)::memset(_First, _Ch, n));
}
// convert metacharacter to character
static char_type to_char_type(const int_type& chMeta)
{
return ((char_type)chMeta);
}
// convert character to metacharacter
static int_type to_int_type(const char_type& ch)
{
return ((unsigned char)ch);
}
// test for metacharacter equality
static bool eq_int_type(const int_type& l, const int_type& r)
{
return (l == r);
}
// return end-of-file metacharacter
static int_type eof()
{
return (EOF);
}
// return anything but EOF
static int_type not_eof(const int_type& chMeta)
{
return (chMeta != eof() ? chMeta : !eof());
}
};
template <
class CharType,
class Traits=fast_char_traits<CharType>,
class Allocator=fast_allocator<CharType,64>
>
class fast_basic_string : public std::basic_string< CharType, Traits, Allocator >
{
public:
typedef fast_basic_string< CharType, Traits, Allocator > MySelf;
typedef std::basic_string< CharType, Traits, Allocator > MyBase;
fast_basic_string(
const typename MyBase::value_type* _Ptr,
typename MyBase::size_type _Count,
const typename MyBase::allocator_type& _Al = Allocator ( )
)
: std::basic_string< CharType, Traits, Allocator >( _Ptr, _Count, _Al )
{}
fast_basic_string(
const typename MyBase::value_type* _Ptr,
const typename MyBase::allocator_type& _Al = Allocator ( )
)
: std::basic_string< CharType, Traits, Allocator >( _Ptr, _Al )
{}
fast_basic_string(
const MyBase& _Right,
typename MyBase::size_type _Roff = 0,
typename MyBase::size_type _Count = npos,
const typename MyBase::allocator_type& _Al = Allocator ( )
)
: std::basic_string< CharType, Traits, Allocator >( _Right, _Roff, _Count, _Al )
{}
fast_basic_string(
typename MyBase::size_type _Count,
typename MyBase::value_type _Ch,
const typename MyBase::allocator_type& _Al = Allocator ( )
)
: std::basic_string< CharType, Traits, Allocator >( _Count, _Ch, _Al )
{}
explicit fast_basic_string(
const typename MyBase::allocator_type& _Al = Allocator ( )
)
: std::basic_string< CharType, Traits, Allocator >( _Al )
{}
#if 0 //ndef _MSC_VER
bool operator == ( const MySelf& str )
{
return ( str.size() != size() ) ? false : MyBase::operator == ( str );
}
#endif
};
#if 1 //def _MSC_VER
template <class Elem, class Traits, class Alloc>
inline
bool operator==(
const fast_basic_string<Elem, Traits, Alloc>& l,
const fast_basic_string<Elem, Traits, Alloc>& r )
{ // test for string equality
return (l.size() != r.size()) ?
false : (l.compare(r) == 0);
}
#endif
typedef fast_basic_string< char > fast_string;
const char* testStr[] =
{
"1", //1
"12", //2
"123", //3
"1234", //4
"12345", //5
"123456", //6
"1234567", //7
"12345678", //8
"123456781", //9
"1234567812", //10
"12345678123", //11
"123456781234", //12
"1234567812345", //13
"12345678123456", //14
"123456781234567", //15
"1234567812345678", //16
"12345678123456781", //17
"123456781234567812", //18
"1234567812345678123", //19
"12345678123456781234567812345678", //32
"12345678123456781234567812345678123456781234567812345678123456", //62
"123456781234567812345678123456781234567812345678123456781234567", //63
"1234567812345678123456781234567812345678123456781234567812345678", //64
"12345678123456781234567812345678123456781234567812345678123456781",
"123456781234567812345678123456781234567812345678123456781234567812",
"1234567812345678123456781234567812345678123456781234567812345678123",
"12345678123456781234567812345678123456781234567812345678123456781234",
"123456781234567812345678123456781234567812345678123456781234567812345678",
"12345678123456781234567812345678123456781234567812345678123456781234567812345678",
"123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678",
"12345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678",
"12345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678"
"12345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678",
};
template <class S, class S2>
inline
int initString( const S2& str )
{
S a( str );
return 0;
}
template <class S, class S2>
inline
int assignString( const S2& str )
{
S a;
a = str;
return 0;
}
template <class S>
inline
int cmpEqString( const S& str1, const S& str2 )
{
return str1 == str2;
}
template <class S>
inline
int cmpLessString( const S& str1, const S& str2 )
{
return str1 < str2;
}
/*
std::list<QString*> listQString;
int alocQString(char const * const pStr)
{
QString* a = new QString(pStr);
listQString.push_back( a );
return 0;
}
int freeQString()
{
std::list<QString*>::iterator it = listQString.begin();
std::list<QString*>::iterator itEnd = listQString.end();
for ( ; it!=itEnd; ++it )
delete *it;
listQString.clear();
return 0;
}
std::list<std::string*> listStdString;
int alocStdString(char const * const pStr)
{
std::string* a = new std::string(pStr);
listStdString.push_back( a );
return 0;
}
int freeStdString()
{
std::list<std::string*>::iterator it = listStdString.begin();
std::list<std::string*>::iterator itEnd = listStdString.end();
for ( ; it!=itEnd; ++it )
delete *it;
listStdString.clear();
return 0;
}
*/
template< class S1,
class S2,
int (*func1)( const S1& ),
int (*func2)( const S2& ),
int nProbes >
void testStringsUnary( char const * const pStr )
{
double dwStart, dwEnd;
S1 s1_op( pStr );
S2 s2_op( pStr );
dwStart = getCurrentTime();
for ( int i = nProbes; i; --i )
volatile int a = func1(s1_op);
dwEnd = getCurrentTime();
double dblDiff1 = dwEnd - dwStart;
dwStart = getCurrentTime();
for ( int i = nProbes; i; --i )
volatile int a = func2(s2_op);
dwEnd = getCurrentTime();
double dblDiff2 = dwEnd - dwStart;
printf( "m1 %f m2 %f m1/m2 %f probs=%d\n", dblDiff1, dblDiff2, dblDiff1/dblDiff2, nProbes );
}
template< class S1,
class S2,
int (*func1)(const S1&, const S1& ),
int (*func2)(const S2&, const S2& ),
int nProbes >
void testStringsBinary( char const * const pStr1, char const * const pStr2 )
{
double dwStart, dwEnd;
S1 s1_op1( pStr1 );
S1 s1_op2( pStr2 );
S2 s2_op1( pStr1 );
S2 s2_op2( pStr2 );
dwStart = getCurrentTime();
for ( int i = nProbes; i; --i )
volatile int a = func1(s1_op1,s1_op2);
dwEnd = getCurrentTime();
double dblDiff1 = dwEnd - dwStart;
dwStart = getCurrentTime();
for ( int i = nProbes; i; --i )
volatile int a = func2(s2_op1,s2_op2);
dwEnd = getCurrentTime();
double dblDiff2 = dwEnd - dwStart;
printf( "m1 %f m2 %f m1/m2 %f probs=%d\n", dblDiff1, dblDiff2, dblDiff1/dblDiff2, nProbes );
}
/*
void testStrings( char const * const pStr )
{
double dwStart, dwEnd;
int nProbes = 5000000;
dwStart = getCurrentTime();
for ( int i = nProbes; i; --i )
volatile int a = alocStdString(pStr);
dwEnd = getCurrentTime();
printf( "alocStdString \t%f\t\t", dwEnd - dwStart );
dwStart = getCurrentTime();
{
volatile int a = freeStdString();
}
dwEnd = getCurrentTime();
printf( "freeStdString \t%f\n", dwEnd - dwStart );
dwStart = getCurrentTime();
for ( int i = nProbes; i; --i )
volatile int a = alocQString(pStr);
dwEnd = getCurrentTime();
printf( "alocQString \t%f\t\t", dwEnd - dwStart );
dwStart = getCurrentTime();
{
volatile int a = freeQString();
}
dwEnd = getCurrentTime();
printf( "freeQString \t%f\n", dwEnd - dwStart );
dwStart = getCurrentTime();
for ( int i = nProbes; i; --i )
volatile int a = alocStdString(pStr);
dwEnd = getCurrentTime();
printf( "alocStdString \t%f\t\t", dwEnd - dwStart );
dwStart = getCurrentTime();
{
volatile int a = freeStdString();
}
dwEnd = getCurrentTime();
printf( "freeStdString \t%f\n", dwEnd - dwStart );
dwStart = getCurrentTime();
for ( int i = nProbes; i; --i )
volatile int a = alocQString(pStr);
dwEnd = getCurrentTime();
printf( "alocQString \t%f\t\t", dwEnd - dwStart );
dwStart = getCurrentTime();
{
volatile int a = freeQString();
}
dwEnd = getCurrentTime();
printf( "freeQString \t%f\n", dwEnd - dwStart );
}
*/
template <class S1, class S2>
void test()
{
#if 1
/*
*/
puts( "constructor(char*) \n"
"============================================================");
for ( int i = 0; i < sizeof(testStr)/sizeof(testStr[0]); ++i )
{
printf("strlen: %3d ", strlen(testStr[i]), testStr[i] );
testStringsUnary<char const * const,
char const * const,
initString<S1, char const * const>,
initString<S2, char const * const>,
1000000>( testStr[i] );
}
#endif
#if 1
/*
*/
puts( "constructor(native) \n"
"============================================================");
for ( int i = 0; i < sizeof(testStr)/sizeof(testStr[0]); ++i )
{
printf("strlen: %3d ", strlen(testStr[i]), testStr[i] );
testStringsUnary<S1,
S2,
initString<S1, S1>,
initString<S2, S2>,
1000000>( testStr[i] );
}
#endif
#if 1
/*
*/
puts( "operator = (char*) \n"
"============================================================");
for ( int i = 0; i < sizeof(testStr)/sizeof(testStr[0]); ++i )
{
printf("strlen: %3d ", strlen(testStr[i]), testStr[i] );
testStringsUnary<char const * const,
char const * const,
assignString<S1, char const * const>,
assignString<S2, char const * const>,
1000000>( testStr[i] );
}
#endif
#if 1
/*
*/
puts( "operator = (native) \n"
"============================================================");
for ( int i = 0; i < sizeof(testStr)/sizeof(testStr[0]); ++i )
{
printf("strlen: %3d ", strlen(testStr[i]), testStr[i] );
testStringsUnary<S1,
S2,
assignString<S1, S1>,
assignString<S2, S2>,
1000000>( testStr[i] );
}
#endif
#if 1
/*
*/
puts( "operator == () (equal strings)\n"
"============================================================");
for ( int i = 0; i < sizeof(testStr)/sizeof(testStr[0]) -1; ++i )
{
printf("strlen: %3d ", strlen(testStr[i]), testStr[i] );
testStringsBinary< S1,
S2,
cmpEqString<S1>,
cmpEqString<S2>,
1000000>( testStr[i], testStr[i] );
}
#endif
#if 1
/*
*/
puts( "operator == () (never equal strings)\n"
"============================================================");
for ( int i = 0; i < sizeof(testStr)/sizeof(testStr[0]) -1; ++i )
{
printf("strlen: %3d ", strlen(testStr[i]), testStr[i] );
testStringsBinary< S1,
S2,
cmpEqString<S1>,
cmpEqString<S2>,
1000000>( testStr[i], testStr[i+1] );
}
#endif
#if 1
/*
*/
puts( "operator < (less strings)\n"
"============================================================");
for ( int i = 0; i < sizeof(testStr)/sizeof(testStr[0]) -1; ++i )
{
printf("strlen: %3d ", strlen(testStr[i]), testStr[i] );
testStringsBinary< S1,
S2,
cmpLessString<S1>,
cmpLessString<S2>,
1000000>( testStr[i], testStr[i+1] );
}
#endif
#if 1
/*
*/
puts( "operator < () (great strings)\n"
"============================================================");
for ( int i = 0; i < sizeof(testStr)/sizeof(testStr[0]) -1; ++i )
{
printf("strlen: %3d ", strlen(testStr[i]), testStr[i] );
testStringsBinary< S1,
S2,
cmpLessString<S1>,
cmpLessString<S2>,
1000000>( testStr[i+1], testStr[i] );
}
#endif
}
int main(int argc, char *argv[])
{
// Init
initGetCurrentTimeLib();
double dwStart, dwEnd;
int nProbes;
QCoreApplication a(argc, argv);
#if 1
puts( "************************************************************\n"
"************************************************************\n"
"Testing m1=QString vs m2=std::string \n"
"************************************************************");
test<QString,std::string>();
#endif
#if 0
puts( "************************************************************\n"
"************************************************************\n"
"Testing m1=QString vs m2=fast_string \n"
"************************************************************");
test<QString,fast_string>();
#endif
// return a.exec();
return 0;
}

8
stdafx.cpp Normal file
View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// test.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

17
stdafx.h Normal file
View File

@@ -0,0 +1,17 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

47
stl_vector_resize.cpp Normal file
View File

@@ -0,0 +1,47 @@
#include <vector>
#include <iostream>
int main( void )
{
std::vector<int> v;
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.push_back( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.resize( 1 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.resize( 0 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.resize( 33 );
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
v.clear();
std::cout << "capacity " << v.capacity() << "\t\tsize " << v.size() << std::endl;
return 0;
}

132
tbb_test/main.cpp Normal file
View File

@@ -0,0 +1,132 @@
#include <iostream>
#include <exception>
#include <string>
#include <algorithm>
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
static const size_t N = 23;
class SubStringFinder
{
const std::string str;
size_t *max_array;
size_t *pos_array;
public:
void operator() ( const tbb::blocked_range<size_t>& r ) const
{
std::cout << "gs:" << r.grainsize() << " b:" << r.begin() << " e:" << r.end() << std::endl;
std::cout.flush();
for ( size_t i = r.begin(); i != r.end(); ++i )
{
size_t max_size = 0, max_pos = 0;
for (size_t j = 0; j < str.size(); ++j)
if (j != i)
{
size_t limit = str.size()-std::max(i,j);
for (size_t k = 0; k < limit; ++k)
{
if (str[i + k] != str[j + k])
break;
if (k > max_size)
{
max_size = k;
max_pos = j;
}
}
}
max_array[i] = max_size;
pos_array[i] = max_pos;
}
}
SubStringFinder(std::string &s, size_t *m, size_t *p)
: str(s), max_array(m), pos_array(p)
{ }
};
int test()
{
std::string str[N] = { std::string("a"), std::string("b") };
for (size_t i = 2; i < N; ++i)
str[i] = str[i-1]+str[i-2];
std::string &to_scan = str[N-1];
size_t num_elem = to_scan.size();
size_t *max = new size_t[num_elem];
size_t *pos = new size_t[num_elem];
tbb::parallel_for( tbb::blocked_range<size_t>(0, num_elem ),
SubStringFinder( to_scan, max, pos ) );
for (size_t i = 0; i < num_elem; ++i)
std::cout << " " << max[i] << "(" << pos[i] << ")" << std::endl;
delete[] pos;
delete[] max;
return 0;
}
class copy_tracker
{
int v;
public:
copy_tracker()
: v(0)
{
std::cout << "copy_tracker::copy_tracker()" << std::endl;
}
copy_tracker( copy_tracker& c )
: v( c.v )
{
std::cout << "copy_tracker::copy_tracker( copy_tracker& c )" << std::endl;
}
void echo()
{
std::cout << v << std::endl;
}
};
copy_tracker copy_tracker_by_value()
{
return copy_tracker();
}
copy_tracker copy_tracker_by_value2()
{
return copy_tracker_by_value();
}
void test_copy_tracker()
{
volatile copy_tracker o = copy_tracker_by_value2();
}
int test_flowgraph()
{
return 0;
}
int main ( void )
{try{
//test();
test_copy_tracker();
return 0;
}
catch ( const std::exception& e )
{
std::cerr << std::endl
<< "std::exception(\"" << e.what() << "\")." << std::endl;
}
catch ( ... )
{
std::cerr << std::endl
<< "unknown exception." << std::endl;
}}

26
tbb_test/tbb_test.sln Normal file
View File

@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tbb_test", "tbb_test.vcxproj", "{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}.Debug|Win32.ActiveCfg = Debug|Win32
{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}.Debug|Win32.Build.0 = Debug|Win32
{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}.Debug|x64.ActiveCfg = Debug|x64
{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}.Debug|x64.Build.0 = Debug|x64
{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}.Release|Win32.ActiveCfg = Release|Win32
{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}.Release|Win32.Build.0 = Release|Win32
{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}.Release|x64.ActiveCfg = Release|x64
{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

155
tbb_test/tbb_test.vcxproj Normal file
View File

@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5771BE40-BCC1-4DBB-9E0B-9B0FEF85927E}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>tbb_test</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(TBB_INCLUDE)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(TBB_LIB64)</AdditionalLibraryDirectories>
<AdditionalDependencies>tbb_debug.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(TBB_INCLUDE)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(TBB_LIB64)</AdditionalLibraryDirectories>
<AdditionalDependencies>tbb_debug.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(TBB_INCLUDE)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(TBB_LIB64)</AdditionalLibraryDirectories>
<AdditionalDependencies>tbb.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(TBB_INCLUDE)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(TBB_LIB64)</AdditionalLibraryDirectories>
<AdditionalDependencies>tbb.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

41
temporary_objects.cpp Normal file
View File

@@ -0,0 +1,41 @@
#include <iostream>
class a
{
public:
a()
{
std::cout << "construction" << std::endl;
}
~a()
{
std::cout << "destruction" << std::endl;
}
};
class guard
{
public:
a _a;
a* operator & ()
{
return &_a;
}
};
guard f()
{
return guard();
}
void g ( a* p )
{
std::cout << "working with a" << std::endl;
}
int main()
{
g( &f() );
return 0;
}

45
test.cpp Normal file
View File

@@ -0,0 +1,45 @@
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#if 0
template <class C>
class aaa
{
public: virtual C getC() = 0;
};
template <class C>
class ccc : public aaa<C>
{
public: virtual C getC(){ return 0; }
};
template class ccc<int>;
template class ccc<double>;
template class ccc<long long>;
class bbb : public ccc<int>,
public ccc<double>,
public ccc<long long>
{
public:
// using ccc<int>::getC;
virtual int ccc<int>::getC() { return 1; }
virtual long long ccc<long long>::getC() { return 1; }
virtual double ccc<double>::getC() { return 1; }
};
#endif
int _tmain(int argc, _TCHAR* argv[])
{
// bbb o;
// int i = static_cast<aaa<int>*>(&o)->getC();
// double d = static_cast<aaa<double>*>(&o)->getC();
// long long ll = static_cast<aaa<long long>*>(&o)->getC();
std::cout << sizeof( long long ) << std::endl;
return 0;
}

20
test.sln Normal file
View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{8AFC11C5-424C-402B-B9B5-12ED039608A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8AFC11C5-424C-402B-B9B5-12ED039608A3}.Debug|Win32.ActiveCfg = Debug|Win32
{8AFC11C5-424C-402B-B9B5-12ED039608A3}.Debug|Win32.Build.0 = Debug|Win32
{8AFC11C5-424C-402B-B9B5-12ED039608A3}.Release|Win32.ActiveCfg = Release|Win32
{8AFC11C5-424C-402B-B9B5-12ED039608A3}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

225
test.vcproj Normal file
View File

@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="test"
ProjectGUID="{8AFC11C5-424C-402B-B9B5-12ED039608A3}"
RootNamespace="test"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\test.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// testConstructorCall.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -0,0 +1,17 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

View File

@@ -0,0 +1,52 @@
// testConstructorCall.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
class a
{
public:
a()
{
printf( "a\n" );
}
~a()
{
printf( "~a\n" );
}
int f()
{
return 0;
}
void operator delete ( void* p )
{
printf( "operator delete()\n" );
}
};
int _tmain(int argc, _TCHAR* argv[])
{
/*
a o;
// o.a( 0 );
o.~a();
o.f();
reinterpret_cast<a*>(0)->a::a();
*/
a* p1 = new a();
delete p1;
a* p2 = new a();
a::operator delete( p2 );
return 0;
}

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testConstructorCall", "testConstructorCall.vcproj", "{BB1AE9BF-69DD-4638-933A-2E513E939A2C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BB1AE9BF-69DD-4638-933A-2E513E939A2C}.Debug|Win32.ActiveCfg = Debug|Win32
{BB1AE9BF-69DD-4638-933A-2E513E939A2C}.Debug|Win32.Build.0 = Debug|Win32
{BB1AE9BF-69DD-4638-933A-2E513E939A2C}.Release|Win32.ActiveCfg = Release|Win32
{BB1AE9BF-69DD-4638-933A-2E513E939A2C}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="testConstructorCall"
ProjectGUID="{BB1AE9BF-69DD-4638-933A-2E513E939A2C}"
RootNamespace="testConstructorCall"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\testConstructorCall.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// testDeviceIOWin32.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -0,0 +1,23 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <iomanip>
#include <windows.h>
#include <winioctl.h>
#include <ntddcdrm.h>
// TODO: reference additional headers your program requires here

View File

@@ -0,0 +1,699 @@
// testDeviceIOWin32.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <windows.h>
#include <winioctl.h>
#include <ntddcdrm.h>
/*
CD
Every byte == 14bit (EFM) ??
Small Frame == 588bit == 24 byte <== this is the unit of read. Can't read smaller portions.
+-----------+------------+--------------+-----------+--------------+-----------+
| Sync code | Subchannel | Main Channel | CIRC code | Main Channel | CIRC code |
| | byte | data | | data | |
bit | 24+3 | 14+3 | 12x(14+3) | 4x(14+3) | 12x(14+3) | 4x(14+3) |
+-----------+------------+--------------+-----------+--------------+-----------+
Frame == 98 Small Frames == 2352 bytes <== this is reachable form soft.
+98 byte of subchannel ( 2 sync bytes + 96 bytes of data )
The first 2 small frames containe sync bytes and then the rest of small frames
containe data bytes.
Session == Lead-in + Program Area + Lead-out
Lead-in == TOC in Q-Subchannel
Program Area == Logical Tracks (at least containes one logical track)
Address format is MSF (Minute/Second/Frame) M=60*S S=75*F
1 Audio Sec = 4(Stereo 16bit)*44100(Hz)=176400 byte = 75 * 2352 byte = 75 Frame
0<= F <= 74
0<= S <= 59
0<= M <= 99
*/
enum {
ADDR_SEC2FRAME = 75,
ADDR_MIN2SEC = 60,
CTRL_COPYPROT_MASK = 0x02, // 0010
CTRL_TYPE_MASK = 0x0C, // 1100
CTRL_AUDIO2CH_TRACK = 0x00, //
CTRL_DATA_TRACK = 0x04, //
CTRL_AUDIO4CH_TRACK = 0x06, //
CTRL_RESERVED_TRACK = 0x0C, //
CTRL_DATA_INCREMENTAL = 0x01, //
CTRL_AUDIO_50_15 = 0x01, //
FRAME_DATA = 2352,
};
#define MAXIMUM_NUMBER_TRACKS 100
#define NSECTORS 13
#define UNDERSAMPLING 1
#define CB_CDDASECTOR 2368
#define CB_QSUBCHANNEL 16
#define CB_CDROMSECTOR 2048
#define CB_AUDIO (CB_CDDASECTOR-CB_QSUBCHANNEL)
/* The code of interest is in the subroutine GetDriveGeometry. The
code in main shows how to interpret the results of the call. */
class device
{
protected:
// Handle to the drive to be examined.
HANDLE hDevice;
DISK_GEOMETRY dg;
CDROM_TOC toc;
bool m_bLocked;
public:
device()
{
hDevice = INVALID_HANDLE_VALUE;
m_bLocked = false;
}
~device()
{
if ( hDevice != INVALID_HANDLE_VALUE )
{
if ( m_bLocked )
storageMediaUnlock();
close();
}
}
bool create( const TCHAR* pszDevice )
{
hDevice = ::CreateFile(pszDevice, // drive to open
GENERIC_READ |
GENERIC_WRITE , // no access to the drive
FILE_SHARE_READ | // share mode
FILE_SHARE_WRITE,
NULL, // default security attributes
OPEN_EXISTING, // disposition
0, // file attributes
NULL); // do not copy file attributes
if (hDevice == INVALID_HANDLE_VALUE) // cannot open the drive
{
printErr("CreateFile");
return false;
}
return true;
}
bool close()
{
if ( hDevice != INVALID_HANDLE_VALUE )
{
::CloseHandle(hDevice);
hDevice = INVALID_HANDLE_VALUE;
}
return true;
}
static void printErr( char* szMsg = "" )
{
printf ("%s Error %ld. ", szMsg, GetLastError ());
char szMsgBfr[ 1024 ];
::FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError (),
0, // Default language
szMsgBfr,
sizeof( szMsgBfr ),
NULL );
szMsgBfr[sizeof( szMsgBfr )-1] = 0;
puts ( szMsgBfr );
}
bool diskGetDriveGeometry()
{
DWORD junk; // discard results
printf("IOCTL_DISK_GET_DRIVE_GEOMETRY\n");
if ( !DeviceIoControl( hDevice, // device to be queried
IOCTL_DISK_GET_DRIVE_GEOMETRY, // operation to perform
NULL, 0, // no input buffer
&dg, sizeof(dg), // output buffer
&junk, // # bytes returned
(LPOVERLAPPED) NULL) ) // synchronous I/O
{
printErr("");
return false;
}
else
{
printf("MediaType = %d\n", dg.MediaType);
printf("Cylinders = %I64d\n", dg.Cylinders);
printf("Tracks/cylinder = %ld\n", (ULONG) dg.TracksPerCylinder);
printf("Sectors/track = %ld\n", (ULONG) dg.SectorsPerTrack);
printf("Bytes/sector = %ld\n", (ULONG) dg.BytesPerSector);
ULONGLONG DiskSize = dg.Cylinders.QuadPart * (ULONG)dg.TracksPerCylinder *
(ULONG)dg.SectorsPerTrack * (ULONG)dg.BytesPerSector;
printf("Disk size = %I64d (Bytes) = %I64d (Gb)\n", DiskSize,
DiskSize / (1024 * 1024 * 1024));
}
puts("");
return true;
}
bool diskGetCacheInformation()
{
DWORD junk; // discard results
DISK_CACHE_INFORMATION dci;
printf("IOCTL_DISK_GET_CACHE_INFORMATION\n");
if ( !DeviceIoControl( hDevice, // device to be queried
IOCTL_DISK_GET_CACHE_INFORMATION, // operation to perform
NULL, 0, // no input buffer
&dci, sizeof(dci), // output buffer
&junk, // # bytes returned
(LPOVERLAPPED) NULL) ) // synchronous I/O
{
printErr("");
return false;
}
else
{
printf("ParametersSavable = %d\n", dci.ParametersSavable);
printf("ReadCacheEnabled = %d\n", dci.ReadCacheEnabled);
printf("WriteCacheEnabled = %d\n", dci.WriteCacheEnabled);
printf("ReadRetentionPriority = %d\n", dci.ReadRetentionPriority);
printf("WriteRetentionPriority = %d\n", dci.WriteRetentionPriority);
printf("DisablePrefetchTransferLength = %d\n", dci.DisablePrefetchTransferLength);
if ( dci.PrefetchScalar )
{
printf("ScalarPrefetch.Minimum = %d\n", dci.ScalarPrefetch.Minimum);
printf("ScalarPrefetch.Maximum = %d\n", dci.ScalarPrefetch.Maximum);
printf("ScalarPrefetch.MaximumBlocks = %d\n", dci.ScalarPrefetch.MaximumBlocks);
}
else
{
printf("BlockPrefetch.Minimum = %d\n", dci.BlockPrefetch.Minimum);
printf("BlockPrefetch.Maximum = %d\n", dci.BlockPrefetch.Maximum);
}
}
puts("");
return true;
}
bool diskPerformance()
{
DWORD junk; // discard results
DISK_PERFORMANCE dp;
printf("IOCTL_DISK_PERFORMANCE\n");
if ( !DeviceIoControl( hDevice, // device to be queried
IOCTL_DISK_PERFORMANCE, // operation to perform
NULL, 0, // no input buffer
&dp, sizeof(dp), // output buffer
&junk, // # bytes returned
(LPOVERLAPPED) NULL) ) // synchronous I/O
{
printErr("");
return false;
}
else
{
printf("BytesRead = %I64d\n", dp.BytesRead);
printf("BytesWritten = %I64d\n", dp.BytesWritten);
printf("ReadTime = %I64d\n", dp.ReadTime);
printf("WriteTime = %I64d\n", dp.WriteTime);
printf("IdleTime = %I64d\n", dp.IdleTime);
printf("ReadCount = %d\n", dp.ReadCount);
printf("WriteCount = %d\n", dp.WriteCount);
printf("QueueDepth = %d\n", dp.QueueDepth);
printf("SplitCount = %d\n", dp.SplitCount);
printf("QueryTime = %I64d\n", dp.QueryTime);
printf("StorageDeviceNumber = %d\n", dp.StorageDeviceNumber);
printf("StorageManagerName = %c%c%c%c%c%c%c%c\n",
dp.StorageManagerName[0], dp.StorageManagerName[1],
dp.StorageManagerName[2], dp.StorageManagerName[3],
dp.StorageManagerName[4], dp.StorageManagerName[5],
dp.StorageManagerName[6], dp.StorageManagerName[7]);
}
puts("");
//////////////////////////////////////////////////////////////////////////////
printf("IOCTL_DISK_PERFORMANCE_OFF\n");
if ( !DeviceIoControl( hDevice, // device to be queried
IOCTL_DISK_PERFORMANCE_OFF, // operation to perform
NULL, 0, // no input buffer
0, 0, // output buffer
&junk, // # bytes returned
(LPOVERLAPPED) NULL) ) // synchronous I/O
{
printErr("");
return false;
}
puts("");
return true;
}
bool diskVerify()
{
DWORD junk; // discard results
VERIFY_INFORMATION vi;
printf("IOCTL_DISK_VERIFY\n");
vi.StartingOffset.QuadPart = 0;
vi.Length = 2048;
if ( !DeviceIoControl( hDevice, // device to be queried
IOCTL_DISK_VERIFY, // operation to perform
&vi, sizeof(vi), // no input buffer
0, 0, // output buffer
&junk, // # bytes returned
(LPOVERLAPPED) NULL) ) // synchronous I/O
{
printErr("");
return false;
}
puts("");
return true;
}
bool storageMediaLock()
{
DWORD junk; // discard results
PREVENT_MEDIA_REMOVAL pmr;
pmr.PreventMediaRemoval = 1;
printf("IOCTL_STORAGE_MEDIA_REMOVAL lock\n");
if ( !::DeviceIoControl( hDevice,
IOCTL_STORAGE_MEDIA_REMOVAL,
&pmr, sizeof( pmr ),
0, 0,
&junk,
(LPOVERLAPPED)0 ) )
{
printErr("");
return false;
}
m_bLocked = true;
return true;
}
bool storageMediaUnlock()
{
DWORD junk; // discard results
PREVENT_MEDIA_REMOVAL pmr;
pmr.PreventMediaRemoval = 0;
printf("IOCTL_STORAGE_MEDIA_REMOVAL unlock\n");
if ( !::DeviceIoControl( hDevice,
IOCTL_STORAGE_MEDIA_REMOVAL,
&pmr, sizeof( pmr ),
0, 0,
&junk,
(LPOVERLAPPED)0 ) )
{
printErr("");
return false;
}
m_bLocked = false;
return true;
}
bool storageLoadMedia()
{
DWORD junk; // discard results
printf("IOCTL_STORAGE_LOAD_MEDIA\n");
if ( !::DeviceIoControl( hDevice,
IOCTL_STORAGE_LOAD_MEDIA,
0, 0,
0, 0,
&junk,
(LPOVERLAPPED)0 ) )
{
printErr("");
return false;
}
else
{
// printf("");
}
return true;
}
bool storageCheckVerify()
{
DWORD junk; // discard results
printf("IOCTL_STORAGE_CHECK_VERIFY\n");
if ( !::DeviceIoControl( hDevice,
IOCTL_STORAGE_CHECK_VERIFY,
0, 0,
0, 0,
&junk,
(LPOVERLAPPED)0 ) )
{
printErr("");
return false;
}
else
{
// printf("");
}
return true;
}
bool storageEjectMedia()
{
DWORD junk; // discard results
printf("IOCTL_STORAGE_EJECT_MEDIA\n");
if ( !::DeviceIoControl( hDevice,
IOCTL_STORAGE_EJECT_MEDIA,
0, 0,
0, 0,
&junk,
(LPOVERLAPPED)0 ) )
{
printErr("");
return false;
}
else
{
// printf("");
}
return true;
}
bool storageReadCapacity()
{
// 2003
#if 0
DWORD junk; // discard results
STORAGE_READ_CAPACITY src;
printf("IOCTL_STORAGE_READ_CAPACITY\n");
if ( !DeviceIoControl( hDevice, // device to be queried
IOCTL_STORAGE_READ_CAPACITY, // operation to perform
NULL, 0, // no input buffer
&src, sizeof(src), // output buffer
&junk, // # bytes returned
(LPOVERLAPPED) NULL) ) // synchronous I/O
{
printErr("");
return false;
}
else
{
printf("Version = %d\n", src.Version);
printf("Size = %d\n", src.Size);
printf("BlockLength = %d\n", src.BlockLength);
printf("NumberOfBlocks = %I64d\n", dg.NumberOfBlocks);
printf("DiskLength = %I64d\n", dg.DiskLength);
}
puts("");
#endif
return true;
}
bool cdromDiskInfo()
{
#if 0
DWORD junk; // discard results
printf("IOCTL_CDROM_DISC_INFO\n");
CDROM_DISCINFO cdi;
if ( !DeviceIoControl( hDevice, // device to be queried
IOCTL_CDROM_DISC_INFO, // operation to perform
0, 0, // no input buffer
&cdi, sizeof( cdi ), // output buffer
&junk, // # bytes returned
(LPOVERLAPPED) NULL) ) // synchronous I/O
{
printErr("");
}
else
{
printf("Reserved = %I64d\n", cdi.Reserved );
printf("FirstTrack = %I64d\n", cdi.FirstTrack );
printf("LastTrack = %I64d\n", cdi.LastTrack );
printf("LastTrack = %I64d\n", cdi.LeadOutTrackAddr );
printf("FirstSession = %I64d\n", cdi.FirstSession );
printf("LastSession = %I64d\n", cdi.LastSession );
printf("ReqSession = %I64d\n", cdi.ReqSession );
printf("RetSession = %I64d\n", cdi.RetSession );
printf("LogicStartAddr = %I64d\n", cdi.LogicStartAddr );
}
puts("");
#endif
}
bool cdromReadTOC()
{
DWORD junk; // discard results
printf("IOCTL_CDROM_READ_TOC\n");
if ( !::DeviceIoControl( hDevice,
IOCTL_CDROM_READ_TOC,
0, 0,
&toc, sizeof(toc),
&junk,
(LPOVERLAPPED)0 ) )
{
printErr("");
return false;
}
else
{
std::cout << "Length = " << (USHORT&)toc.Length << std::endl;
std::cout << "FirstTrack = " << int(toc.FirstTrack) << std::endl;
std::cout << "LastTrack = " << int(toc.LastTrack) << std::endl;
for ( int i = 0; i < (toc.LastTrack - toc.FirstTrack +1); ++i )
{
std::cout << "track " << i << " {" << std::endl;
if ( toc.TrackData[i].Control & CTRL_COPYPROT_MASK )
std::cout << " No copy protection" << std::endl;
else
std::cout << " Copy protected" << std::endl;
int n = toc.TrackData[i].Control & CTRL_TYPE_MASK;
if ( n == CTRL_AUDIO2CH_TRACK )
std::cout << " 2 channel audio track" << std::endl;
else if ( n == CTRL_AUDIO4CH_TRACK )
std::cout << " 4 channel audio track" << std::endl;
else if ( n == CTRL_DATA_TRACK )
std::cout << " Data track" << std::endl;
else
std::cout << " Unknown type of track" << std::endl;
if ( n == CTRL_DATA_TRACK )
{
if ( toc.TrackData[i].Control & CTRL_DATA_INCREMENTAL )
std::cout << " Incremental record" << std::endl;
else
std::cout << " Continuous record" << std::endl;
}
else
{
if ( toc.TrackData[i].Control & CTRL_AUDIO_50_15 )
std::cout << " Predistortion 50/15 mks" << std::endl;
else
std::cout << " No predistortion" << std::endl;
}
std::cout << " Adr = " << int(toc.TrackData[i].Adr) << std::endl;
std::cout << " TrackNumber = " << int(toc.TrackData[i].TrackNumber) << std::endl;
std::cout << " Address[0] = " << int(toc.TrackData[i].Address[0]) << std::endl;
std::cout << " Minute = " << int(toc.TrackData[i].Address[1]) << std::endl;
std::cout << " Second = " << int(toc.TrackData[i].Address[2]) << std::endl;
std::cout << " Frame = " << int(toc.TrackData[i].Address[3]) << std::endl;
std::cout << " Start Sector = " << toc.TrackData[i].Address[1] * ADDR_MIN2SEC * ADDR_SEC2FRAME
+ toc.TrackData[i].Address[2] * ADDR_SEC2FRAME
+ toc.TrackData[i].Address[3] << std::endl;
std::cout << "}" << std::endl;
}
}
return true;
}
virtual int cdromRawRead( int sector, int num, char* buf, int buf_size );
};
int device::cdromRawRead( int sector, int num, char* buf, int buf_size )
{
DWORD nBytsRead = 0;
RAW_READ_INFO rri;
// rri.TrackMode = CDDA;
rri.TrackMode = YellowMode2;
rri.SectorCount = num;
rri.DiskOffset.QuadPart = sector*CB_CDROMSECTOR;
memset ( buf, 0, buf_size );
#if 1
// std::cout << "IOCTL_CDROM_RAW_READ" << std::endl;
if ( !::DeviceIoControl( hDevice,
IOCTL_CDROM_RAW_READ,
&rri, sizeof(rri),
buf, buf_size,
&nBytsRead,
(LPOVERLAPPED)0 ) )
{
int i = 0;
char tmp[32];
for ( ; i < buf_size && !buf[i]; ++i );
if ( i < buf_size )
_snprintf( tmp, sizeof( tmp), "Sector %d buf!=0", sector );
else
_snprintf( tmp, sizeof( tmp), "Sector %d", sector );
printErr( tmp );
return false;
}
else
#endif
{
#if 0
std::cout << " Read " << nBytsRead << " bytes" << std::endl;
const int cCol = 16;
for ( int i = 0; i < int(nBytsRead) ; )
{
int k = i;
for ( int j = 0; j < cCol && k < int(nBytsRead); ++k, ++j )
{
std::cout << std::hex << (((unsigned)( buf[k] ) >> 4) & 0xF ) << ((unsigned)( buf[k] ) & 0x0F ) << " ";
}
for ( int j = 0; j < cCol && i < int(nBytsRead); ++i, ++j )
{
if ( 32 < buf[i] && buf[i] < 255 )
std::cout << buf[i];
else
std::cout << ' ';
}
std::cout << std::endl;
}
#endif
}
// CB_CDROMSECTOR
#if 0
if (m_bTocValid && ((sector + NumSectors) <= GetEndSector(m_TOC.LastTrack)))
{
RAW_READ_INFO rri;
rri.TrackMode = CDDA;
rri.SectorCount = (DWORD)NumSectors;
rri.DiskOffset.QuadPart = sector*CB_CDROMSECTOR;
DWORD charsRead = 0;
if (::DeviceIoControl(m_hDrive, IOCTL_CDROM_RAW_READ, &rri, sizeof(rri), Buffer, (DWORD)NumSectors * CB_AUDIO, &charsRead, NULL) != 0)
return true;
else
return false;
}
else
return false;
#endif
return nBytsRead;
}
int _tmain(int argc, _TCHAR* argv[])
{
//TCHAR szDevice[] = L"\\\\.\\PhysicalDrive0";
//TCHAR szDevice[] = L"\\\\.\\PhysicalDrive2";
TCHAR szDevice[] = L"\\\\.\\E:";
FILE* f = fopen( "dump.txt", "wb" );
device d;
if ( !d.create( szDevice ) )
{
std::cerr << "Cannot open device." << std::endl;
return 1;
}
if ( !d.storageCheckVerify() )
{
std::cerr << "Media is not accessable." << std::endl;
return 2;
}
if ( !d.storageMediaLock() )
{
std::cerr << "Cannot lock the media." << std::endl;
return 3;
}
// d.diskGetDriveGeometry();
// d.storageReadCapacity();
// d.diskGetCacheInformation();
// d.diskPerformance();
// d.cdromDiskInfo();
d.cdromReadTOC();
const int nStart = 000;
const int nAmount = nStart + 350000;
int i = nStart;
char buf[ 2*FRAME_DATA ];
for ( ; i < nAmount; ++i )
{
int n = d.cdromRawRead( i, 1, buf, sizeof( buf ) );
// fwrite( buf, 1, n, f );
}
d.storageMediaUnlock();
d.storageMediaUnlock();
d.storageMediaUnlock();
d.storageMediaUnlock();
d.storageMediaUnlock();
d.storageMediaUnlock();
// d.storageEjectMedia();
d.close();
fclose( f );
return 0;
}

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testDeviceIOWin32", "testDeviceIOWin32.vcproj", "{E94938D0-9C6D-4792-824D-919AC911027C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E94938D0-9C6D-4792-824D-919AC911027C}.Debug|Win32.ActiveCfg = Debug|Win32
{E94938D0-9C6D-4792-824D-919AC911027C}.Debug|Win32.Build.0 = Debug|Win32
{E94938D0-9C6D-4792-824D-919AC911027C}.Release|Win32.ActiveCfg = Release|Win32
{E94938D0-9C6D-4792-824D-919AC911027C}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="testDeviceIOWin32"
ProjectGUID="{E94938D0-9C6D-4792-824D-919AC911027C}"
RootNamespace="testDeviceIOWin32"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\testDeviceIOWin32.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

19
testLong64.cpp Normal file
View File

@@ -0,0 +1,19 @@
// testLong64.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include <iostream>
//#define long __int64
int main(int argc, char * argv[])
{
std::cout << "short " << sizeof( short ) << std::endl;
std::cout << "int " << sizeof( int ) << std::endl;
std::cout << "long " << sizeof( long ) << std::endl;
std::cout << "long long " << sizeof( long long ) << std::endl;
std::cout << "void* " << sizeof( void* ) << std::endl;
return 0;
}

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// testMultipleDerviation.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -0,0 +1,19 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
// TODO: reference additional headers your program requires here

View File

@@ -0,0 +1,124 @@
// testMultipleDerviation.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
class a
{
public:
virtual void f() = 0;
};
class b : public virtual a
{
public:
virtual void g() = 0;
};
class c : public virtual a
{
int n;
public:
c()
{ n = 0; }
virtual void f()
{ ++n; }
};
class d : public b, public c
{
public:
// virtual void f()
// {
// c::f();
// }
virtual void g()
{
puts( "d::g()" );
}
};
class a2
{
public:
virtual void f() = 0;
};
class b2 : public virtual a
{
public:
virtual void g() = 0;
};
class c2 : public a2
{
int n;
public:
c2()
{ n = 0; }
virtual void f()
{ ++n; }
};
class d2 : public b2, public c2
{
public:
virtual void f()
{
c2::f();
}
virtual void g()
{
puts( "d::g()" );
}
};
int main(int argc, _TCHAR* argv[])
{
const int nAmount = 1000000000;
d o;
d2 o2;
int nWins1 = 0;
int nWins2 = 0;
for ( ; true ; )
{
DWORD dwStart = GetTickCount();
for ( register int n = nAmount; n; --n )
o.f();
DWORD dwDuration = GetTickCount() - dwStart;
printf( "Virtual inheritence takes %dms\n", dwDuration );
DWORD dwStart2 = GetTickCount();
for ( register int n = nAmount; n; --n )
o2.f();
DWORD dwDuration2 = GetTickCount() - dwStart2;
printf( "Redirection of function %dms\n", dwDuration2 );
if ( dwDuration2 > dwDuration )
++nWins1;
else
++nWins2;
printf( "count %d : %d\n\n", nWins1, nWins2 );
}
return 0;
}

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testMultipleDerviation", "testMultipleDerviation.vcproj", "{79D765B8-B695-498E-B1E2-BDC2A6474311}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{79D765B8-B695-498E-B1E2-BDC2A6474311}.Debug|Win32.ActiveCfg = Debug|Win32
{79D765B8-B695-498E-B1E2-BDC2A6474311}.Debug|Win32.Build.0 = Debug|Win32
{79D765B8-B695-498E-B1E2-BDC2A6474311}.Release|Win32.ActiveCfg = Release|Win32
{79D765B8-B695-498E-B1E2-BDC2A6474311}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="testMultipleDerviation"
ProjectGUID="{79D765B8-B695-498E-B1E2-BDC2A6474311}"
RootNamespace="testMultipleDerviation"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\testMultipleDerviation.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// testOutputIterator.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -0,0 +1,17 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

View File

@@ -0,0 +1,37 @@
// testOutputIterator.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <list>
int _tmain(int argc, _TCHAR* argv[])
{
#if 0
std::vector<int> v;
std::vector<int>::iterator ot = v.begin();
*++ot = 1;
*++ot = 2;
*++ot = 3;
*++ot = 4;
#endif
std::list<int> l;
l.push_back( 1 );
l.push_back( 2 );
// l.splice( l.begin(), l, l.begin() );
std::cout << &(*l.begin()) << " " << &(*++l.begin()) << " " << *l.begin() << " " << *++l.begin() << std::endl;
std::swap( l.begin(), ++l.begin() );
std::cout << &(*l.begin()) << " " << &(*++l.begin()) << " " << *l.begin() << " " << *++l.begin() << std::endl;
return 0;
}

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testOutputIterator", "testOutputIterator.vcproj", "{2F4EF401-584C-4DD9-B360-115A4620CF89}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2F4EF401-584C-4DD9-B360-115A4620CF89}.Debug|Win32.ActiveCfg = Debug|Win32
{2F4EF401-584C-4DD9-B360-115A4620CF89}.Debug|Win32.Build.0 = Debug|Win32
{2F4EF401-584C-4DD9-B360-115A4620CF89}.Release|Win32.ActiveCfg = Release|Win32
{2F4EF401-584C-4DD9-B360-115A4620CF89}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="testOutputIterator"
ProjectGUID="{2F4EF401-584C-4DD9-B360-115A4620CF89}"
RootNamespace="testOutputIterator"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\testOutputIterator.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Some files were not shown because too many files have changed in this diff Show More