aboutsummaryrefslogtreecommitdiffstats
path: root/Hilbert
diff options
context:
space:
mode:
Diffstat (limited to 'Hilbert')
-rw-r--r--Hilbert/BigBitVec.hpp121
-rw-r--r--Hilbert/FixBitVec.hpp83
-rw-r--r--Hilbert/GrayCodeRank.hpp40
3 files changed, 0 insertions, 244 deletions
diff --git a/Hilbert/BigBitVec.hpp b/Hilbert/BigBitVec.hpp
index 8f7c485..175a96a 100644
--- a/Hilbert/BigBitVec.hpp
+++ b/Hilbert/BigBitVec.hpp
@@ -124,53 +124,6 @@ public:
}
- // Resize function. Returns the number of bits
- // we can accomodate after resizing.
- CBigBitVec &
- setSize(
- int iBits
- )
- {
- int i;
-
- // How many racks do we need?
- int iRacks = FBVS_NEEDED(iBits);
-
- // Same size?
- if ( iRacks == m_iRacks )
- return (*this);
-
- // Allocate new racks.
- CFixBitVec *pcRacks = new CFixBitVec[iRacks];
-
- // Copy over the old values.
- /*for ( i = 0; i < BBV_MIN(iRacks,m_iRacks); i++ )
- pcRacks[i] = m_pcRacks[i];*/
- i = BBV_MIN(iRacks,m_iRacks);
- if (m_pcRacks) {
- memcpy( static_cast<void*>(pcRacks),
- static_cast<const void*>(m_pcRacks),
- sizeof(CFixBitVec)*i );
- }
-
- // zero the new values
- /*for ( ; i < iRacks; i++ )
- pcRacks[i].reset();*/
- if ( iRacks > i )
- memset( static_cast<void*>(pcRacks + i), 0,
- sizeof(CFixBitVec)*(iRacks-i) );
-
- // Release the old stuff.
- delete [] m_pcRacks;
-
- // Replace old with new.
- m_iRacks = iRacks;
- m_pcRacks = pcRacks;
-
- return (*this);
- }
-
-
// zeros the bit-vector.
CBigBitVec &
reset()
@@ -670,19 +623,6 @@ public:
}
- // Right rotation.
- CBigBitVec
- rotrCopy(
- int iBits,
- int iWidth
- ) const
- {
- CBigBitVec t( *this );
- t.rotr(iBits,iWidth);
- return t;
- }
-
-
// Left rotation, in place.
CBigBitVec &
rotl(
@@ -715,19 +655,6 @@ public:
}
- // Left rotation.
- CBigBitVec
- rotlCopy(
- int iBits,
- int iWidth
- ) const
- {
- CBigBitVec t( *this );
- t.rotl(iBits,iWidth);
- return t;
- }
-
-
// Returns true if the rack is zero valued.
bool
none() const
@@ -739,41 +666,6 @@ public:
}
- // Returns the number of trailing set bits.
- int
- tsb() const
- {
- int c, i, j;
- c = 0;
- for ( i = 0; i < m_iRacks; i++ )
- {
- j = m_pcRacks[i].tsb();
- c += j;
- if ( j < FBV_BITS )
- break;
- }
- return c;
- }
-
- // OB:
- // Returns the index of the most significant bit (numbered
- // 1 to n)
- int
- msb() const
- {
- int c, i, j = 0;
- c = FBV_BITS * m_iRacks;
- for ( i = m_iRacks - 1; i >= 0 && !j; i-- )
- {
- j = m_pcRacks[i].msb();
- if (j)
- return c - (FBV_BITS - j);
- else
- c -= FBV_BITS;
- }
- return 0;
- }
-
// Returns the index of the first set bit.
// (numbered 1 to n, with 0 meaning no bits were set)
int
@@ -793,19 +685,6 @@ public:
}
- // Prefix decrement. Returns true if there
- // was a carry, false otherwise.
- bool
- operator--()
- {
- int i = 0;
- bool b;
- while ( i < m_iRacks && (b = --m_pcRacks[i]) ) i++;
-
- return b;
- }
-
-
// Gray Code
CBigBitVec &
grayCode()
diff --git a/Hilbert/FixBitVec.hpp b/Hilbert/FixBitVec.hpp
index 7708064..60f4384 100644
--- a/Hilbert/FixBitVec.hpp
+++ b/Hilbert/FixBitVec.hpp
@@ -80,16 +80,6 @@ public:
return FBV_BITS;
}
- // Sets the size. This is a dummy
- // function just for BigBitVec compatibility.
- CFixBitVec &
- setSize(
- int iBits
- )
- {
- return (*this);
- }
-
// Zeros the bit-vector.
CFixBitVec &
reset()
@@ -338,18 +328,6 @@ public:
return (*this);
}
- // Right rotation.
- CFixBitVec
- rotrCopy(
- int iBits,
- int iWidth
- ) const
- {
- CFixBitVec t(*this);
- t.rotr(iBits,iWidth);
- return t;
- }
-
// Left rotation, in place.
CFixBitVec &
rotl(
@@ -366,18 +344,6 @@ public:
return (*this);
}
- // Left rotation.
- CFixBitVec
- rotlCopy(
- int iBits,
- int iWidth
- ) const
- {
- CFixBitVec t(*this);
- t.rotl(iBits,iWidth);
- return t;
- }
-
// Is the bit rack zero valued?
bool
none() const
@@ -385,48 +351,6 @@ public:
return m_uiRack == 0;
}
- // Returns the number of trailing set bits.
- int
- tsb() const
- {
- FBV_UINT i = m_uiRack;
- int c = 0;
-
-#if FBV_BITS == 64
- if ( i == FBV1S ) return 64;
- if ( (i&FBVN1S(32)) == FBVN1S(32) ) { i>>=32; c^=32; }
-#elif FBV_BITS == 32
- if ( i == FBV1S ) return 32;
-#endif
- if ( (i&FBVN1S(16)) == FBVN1S(16) ) { i>>=16; c^=16; }
- if ( (i&FBVN1S( 8)) == FBVN1S( 8) ) { i>>= 8; c^= 8; }
- if ( (i&FBVN1S( 4)) == FBVN1S( 4) ) { i>>= 4; c^= 4; }
- if ( (i&FBVN1S( 2)) == FBVN1S( 2) ) { i>>= 2; c^= 2; }
- if ( (i&FBVN1S( 1)) == FBVN1S( 1) ) { i>>= 1; c^= 1; }
-
- return c;
- }
-
- // Returns the index of the most significant bit
- int
- msb() const
- {
- FBV_UINT i = m_uiRack;
- int c = 0;
-#if FBV_BITS == 64
- if ( i == FBV0 ) return 0;
- if ( i & (FBVN1S(32) << 32) ) { i >>= 32; c ^= 32; }
-#elif FBV_BITS == 32
- if ( i == FBV0 ) return 0;
-#endif
- if ( i & (FBVN1S(16) << 16) ) { i >>= 16; c ^= 16; }
- if ( i & (FBVN1S( 8) << 8) ) { i >>= 8; c ^= 8; }
- if ( i & (FBVN1S( 4) << 4) ) { i >>= 4; c ^= 4; }
- if ( i & (FBVN1S( 2) << 2) ) { i >>= 2; c ^= 2; }
- if ( i & (FBVN1S( 1) << 1) ) { i >>= 1; c ^= 1; }
- return ++c;
- }
-
// Returns the index of the first set bit, numbered from
// 1 to n. 0 means there were no set bits.
int
@@ -450,13 +374,6 @@ public:
return ++c;
}
- // Prefix decrement. Returns true if a carry
- // was generated.
- bool
- operator--()
- {
- return ( m_uiRack-- == 0 );
- }
// Calculates the Gray Code.
CFixBitVec &
diff --git a/Hilbert/GrayCodeRank.hpp b/Hilbert/GrayCodeRank.hpp
index 1165598..f4f46d1 100644
--- a/Hilbert/GrayCodeRank.hpp
+++ b/Hilbert/GrayCodeRank.hpp
@@ -53,46 +53,6 @@ namespace Hilbert
// Run through the levels of precision
for ( i = 0; i < m; i++ )
{
- // #D
- // int k = ds[i] + 1;
- // if ( k == n ) k = 0;
- // j = k;
-
-/*#define COMP { \
- if(ms[j]>i) { \
- if(h.racks()[hr]&hm)hc.racks()[hcr]|=hcm; \
- hcm<<=1;if(hcm==0){hcm=1;++hcr;} \
- } \
- if((++j)==n)j=0; \
- hm<<=1;if(hm==0){hm=1;++hr;} \
- }
-#define COMP1(a) case a: COMP;
-#define COMP2(a) COMP1(a+1); \
- COMP1(a);
-#define COMP4(a) COMP2(a+2); \
- COMP2(a);
-#define COMP8(a) COMP4(a+4); \
- COMP4(a);
-#define COMP16(a) COMP8(a+8); \
- COMP8(a);
-#define COMP32(a) COMP16(a+16); \
- COMP16(a);
-
- // This complicated mess only buys a marginal performance increase.
- int k, kd;
- k = n;
- j = ds[i];
- while ( k )
- {
- kd = k;
- switch ( kd )
- {
- default: kd = 32;
- COMP32(1);
- }
- k -= kd;
- }*/
-
// Run through the dimensions
j = ds[i];
do