Endianness: Let’s say you want to write a program for comparing two strings. You have a choice of using a 32-bit byte-addressable Big-endian or Little-endian architecture to do this. In either case, you can pack 4 characters in each word of 32-bits. Which one would you choose and how will you write such a program? [Hint: Normally, you would do string comparison one character at a time. If you can do it a word at a time instead of a character at a time, that implementation will be faster.]

What will be an ideal response?

The choice of endianness should not matter, so long as you are consistent in the comparison. Subtract each word in string A from string B. If you return zero, the strings are identical. Note, you can only perform this operation on the same system. The operation will be more complex if you are trying to compare a Big-endian system to a Little-endian system. You would have to compare character by character.

Computer Science & Information Technology

You might also like to view...

Each field name used in a(n) ________ must be enclosed within its own pair of square brackets, and the new field name must be followed by a colon.

a. calculated field b. condition c. expression d. wildcard character

Computer Science & Information Technology

What lets you know when your files need to be backed up?

A) Action Center B) Windows updates C) Firewall D) Windows Defender

Computer Science & Information Technology