Question: Convert the following C code into x86 Assembly AT&T Notation char crcTable[256] = {0}; /* Global Initialized to 0. DATA Segment*/ void crcInit(void) { char

Convert the following C code into x86 Assembly AT&T Notation

char crcTable[256] = {0}; /* Global Initialized to 0. DATA Segment*/

void crcInit(void)

{

char remainder;

int dividend;

char bit;

/*

* Compute the remainder of each possible dividend.

*/

for (dividend = 0; dividend < 256; ++dividend)

{

/*

* Start with the dividend followed by zeros.

*/

remainder = dividend;

/*

* Perform modulo-2 division, a bit at a time.

*/

for (bit = 8; bit > 0; --bit)

{

/*

* Try to divide the current data bit.

*/

if (remainder & 0x80)

{

remainder = (remainder << 1) ^ POLYNOMIAL;

}

else

{

remainder = (remainder << 1);

}

}

/*

* Store the result into the table.

*/

crcTable[dividend] = remainder;

}

}

char crcFast(char* message, long nBytes)

{

unsigned char data;

char remainder = 0;

long byte;

/*

* Divide the message by the polynomial, a byte at a time.

*/

for (byte = 0; byte < nBytes; ++byte)

{

data = message[byte] ^ remainder;

remainder = crcTable[data];

}

/*

* The final remainder is the CRC.

*/

return remainder;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!