From 157a8ee41fad778a17233d7029c7632493c2185f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Wed, 7 Oct 2020 13:19:42 +0200 Subject: [PATCH] replace % with & to save space require to compile with newer SDCC --- pic/318LPW1K-L/318LPW1K-L.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pic/318LPW1K-L/318LPW1K-L.c b/pic/318LPW1K-L/318LPW1K-L.c index 58698fb..464b3ed 100644 --- a/pic/318LPW1K-L/318LPW1K-L.c +++ b/pic/318LPW1K-L/318LPW1K-L.c @@ -82,15 +82,15 @@ uint8_t read_eeprom(uint8_t address) { /* transmit the megacode */ void megacode (void) { static uint8_t byte; - uint8_t bit = phase/4; + uint8_t bit = phase / 4; if (transmit != 0) { - if (bit%8==0) { // read byte to transmit - byte = read_eeprom(bit/8); + if (bit & 0x7 == 0) { // read byte to transmit + byte = read_eeprom(bit / 8); } - if (bit<24) { // transmit bit - if (phase%2) { - uint8_t pulse = (byte>>((23-bit)%8))&0x01; - if ((phase%4==1 && !pulse) || (phase%4==3 && pulse)) { + if (bit < 24) { // transmit bit + if (phase & 0x1) { + uint8_t pulse = (byte >> ((23 - bit) & 0x7)) & 0x01; + if ((phase & 0x3 == 1 && !pulse) || (phase & 0x3 == 3 && pulse)) { led_off(); tx_on(); }