LAB2 Calculating Hamming Distance - PowerPoint PPT Presentation

parson
lab2 calculating hamming distance n.
Skip this Video
Loading SlideShow in 5 Seconds..
LAB2 Calculating Hamming Distance PowerPoint Presentation
Download Presentation
LAB2 Calculating Hamming Distance

play fullscreen
1 / 3
Download Presentation
LAB2 Calculating Hamming Distance
214 Views
Download Presentation

LAB2 Calculating Hamming Distance

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. LAB2Calculating Hamming Distance

  2. Main methods 1. C=x0001; Sum=0; 2. D=C&A; E=C&B; 3. 1)D==E 进入4 2)D≠E Sum++; 进入4; 4.C<<1; 1)C==0;进入5 2)C≠ 0;回到2 5. Sum为所求Hamming距离 1. R4=0;Sum=0; 2. A、B最高位0,R4++; A、B最高位1,R4 --; 3. R4==0,Sum++; 4. A、B左移1位; 回到2; 循环16次; A和B直接比较

  3. Main methods C=A⊕ B;C=A⊙B 1. Sum=0; 2. (1)C==0;进入3 (2)C≠0; Sum++; D=C&(C-1); C=D; 回到2 3.Sum是C中1的个数 计算C中1的个数 掩码相与, 逐位计数