What to do
Fulfill the requirement "randomly insert a single bit error into the frame checksum field before a frame is sent"
How to flip a random bit of a 32-bit checksum. (Need help? Please check bitTwiddle.pdf )- Convert the CRC into a 4-byte character array
- Randomly choose a byte of that character array and then choose a bit of that byte
- Generate the mask for that byte
- Xor the chosen byte with the mask
Bitwise operators in C, a tutorial.
http://www.cprogramming.com/tutorial/bitwise_operators.html
Generate an random integer within range in C.
http://stackoverflow.com/questions/822323/how-to-generate-a-random-number-in-c
code snippet
#include
The most efficient way to implement an integer based power function pow(int, int) (Proved correct)
http://stackoverflow.com/questions/101439/the-most-efficient-way-to-implement-an-integer-based-power-function-powint-int !!!
http://stackoverflow.com/questions/101439/the-most-efficient-way-to-implement-an-integer-based-power-function-powint-int !!!
Convert a 4-byte char array into a 32-bit int !!!
code snippet
code snippet
unsigned int CharArrToUnsignedInt(char * charArr) { unsigned int i = *(int *)charArr; }
No comments:
Post a Comment