Changed modulo and division operations on 256 to bit shift using include/bytes.h macro to improve code size on architectures that don't do division natively.

This commit is contained in:
skarg
2009-08-20 14:38:25 +00:00
parent e513ffa412
commit 4b422d6c1c
7 changed files with 20 additions and 14 deletions
+4 -2
View File
@@ -42,6 +42,7 @@
#include "crc.h"
#include "npdu.h"
#include "bits.h"
#include "bytes.h"
#include "bacaddr.h"
/* special optimization - I-Am response in this module */
#include "client.h"
@@ -331,9 +332,10 @@ static void MSTP_Send_Frame(
crc8 = CRC_Calc_Header(buffer[3], crc8);
buffer[4] = source;
crc8 = CRC_Calc_Header(buffer[4], crc8);
buffer[5] = pdu_len / 256;
buffer[5] = HI_BYTE(pdu_len);
crc8 = CRC_Calc_Header(buffer[5], crc8);
buffer[6] = pdu_len % 256;
buffer[6] = LO_BYTE(pdu_len);
crc8 = CRC_Calc_Header(buffer[6], crc8);
buffer[7] = ~crc8;
if (pdu_len) {