hmwk2_prob3_ch - { ++dist; val &= val - 1; }...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
3- (Assembly language) Write an assembly language function to determine the hamming distance ( the number of different bits) between two characters passed as parameter. An implementation of Hamming distance in C programming language is copied below. int returndistance( int x, int y) { unsigned dist = 0, val = x ^ y; // Count the number of set bits while(val)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { ++dist; val &= val - 1; } return(dist); } The assembly language skeleton for the function is given as below. .global _returndistance _returndistance: pushl %ebp movl %esp , %ebp movl 8( %ebp ), %ebx movl 12( %ebp ), %edx // TODO : Write your code for finding hamming distance here // put distance to be returned in eax movl %ebp , %esp popl %ebp ret...
View Full Document

This note was uploaded on 06/07/2011 for the course COMPE 271 taught by Professor Staff during the Spring '08 term at San Diego State.

Ask a homework question - tutors are online