1 / 3

LAB2 Calculating Hamming Distance

LAB2 Calculating Hamming Distance. 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++;

parson
Download Presentation

LAB2 Calculating Hamming Distance

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

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的个数 掩码相与, 逐位计数

More Related