コード例 #1
0
 public void setValue(LongDescripter i_src)
 {
     //assert i_src.bits==this.bits;
     System.Array.Copy(i_src._desc, this._desc, this._desc.Length);
     //System.arraycopy(i_src._desc,0,this._desc,0,this._desc.Length);
     // TODO Auto-generated method stub
 }
コード例 #2
0
        /**
         * i_valueとの間でHammingDistanceを計算します。
         * @param i_value
         * @return
         */
        virtual public int hammingDistance(LongDescripter i_value)
        {
            int r = 0;

            for (int i = 0; i < i_value._desc.Length; i++)
            {
                r += Hamming.HammingDistance64(this._desc[i], i_value._desc[i]);
            }
            return(r);
        }
コード例 #3
0
        sealed override public int hammingDistance(LongDescripter i_value)
        {
            //assert i_value.bits==this.bits;
            long b;
            long c = 0;

            for (int i = this._desc.Length - 1; i >= 0; i--)
            {
                b  = this._desc[i] ^ i_value._desc[i];
                b  = (b & 0x5555555555555555L) + (b >> 1 & 0x5555555555555555L);
                b  = (b & 0x3333333333333333L) + (b >> 2 & 0x3333333333333333L);
                b  = (b & 0x0f0f0f0f0f0f0f0fL) + (b >> 4 & 0x0f0f0f0f0f0f0f0fL);
                b  = (b & 0x00ff00ff00ff00ffL) + (b >> 8 & 0x00ff00ff00ff00ffL);
                b  = (b & 0x0000ffff0000ffffL) + (b >> 16 & 0x0000ffff0000ffffL);
                b  = (b & 0x00000000ffffffffL) + (b >> 32 & 0x00000000ffffffffL);
                c += b;
            }
            return((int)c);
        }