Computer Science Homework Help

Delaware County Community College Working on Assembly Language Exercise

 


(50) Write a function numones(x) in x86 assembly language that would
report the number of 1’s in the argument x, which is assumed to be a
four byte integer. For example numones(7) should return 3, numones(12)
should return 2, and numones(1022) should return 9.
Write numones() so that it could be assembled using NASM and linked
to a calling program using gcc and called from C using:
y = numones(x);
where x is a declared as int. Make sure that your program is wellcommented so that it becomes easy to read and you have clearly described
how it works. Code which is hard to read will not receive full credit,
whether it is correct or not.