Changeset 7cfd6d4
- Timestamp:
- Mar 19, 2019, 4:07:13 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 81a05ca
- Parents:
- 2e041e27
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/coroutine/devicedriver.cfa
r2e041e27 r7cfd6d4 10 10 // Created On : Sat Mar 16 15:30:34 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 18 08:29:20201913 // Update Count : 7912 // Last Modified On : Tue Mar 19 15:59:06 2019 13 // Update Count : 87 14 14 // 15 15 … … 28 28 } // next 29 29 30 void checkCRC( Driver & d, unsigned int sum ) with( d ) { 31 suspend(); 32 unsigned short int crc = byte << 8; // sign extension over written 33 suspend(); 34 // prevent sign extension for signed char 35 status = (crc | (unsigned char)byte) == sum ? MSG : ECRC; 36 } // checkCRC 37 30 38 void main( Driver & d ) with( d ) { 31 39 enum { STX = '\002', ESC = '\033', ETX = '\003', MaxMsg = 64 }; 32 unsigned short int crc; // error checking33 40 msg: for () { // parse message 34 41 status = CONT; … … 52 59 } // for 53 60 msg[lnth] = '\0'; // terminate string 54 suspend(); 55 crc = (unsigned char)byte << 8; // prevent sign extension for signed char 56 suspend(); 57 status = (crc | (unsigned char)byte) == sum ? MSG : ECRC; 61 checkCRC( d, sum ); // refactor CRC check 58 62 suspend(); 59 63 } // for
Note: See TracChangeset
for help on using the changeset viewer.