Re: [Sdcc-user] Assembler variable overflow

2023-08-17 Thread Philipp Klaus Krause
Am 17.08.23 um 23:27 schrieb Alan Cox: How do you check over/underflow in C without wasting memory? If your compiler is smart enough then for unsigned maths r = a + b; if (r < a) will be optimized nicely. I've not checked if sdcc knows that and will turn it into a carry check

Re: [Sdcc-user] Assembler variable overflow

2023-08-17 Thread Alan Cox
> How do you check over/underflow in C without wasting memory? If your compiler is smart enough then for unsigned maths r = a + b; if (r < a) will be optimized nicely. I've not checked if sdcc knows that and will turn it into a carry check at least for uint8 and uint16. For sign

Re: [Sdcc-user] Assembler variable overflow

2023-08-17 Thread Benedikt Freisen
Hi! Am 17.08.23 um 22:13 schrieb Michael A Hawkins: Hello SDCC users, I am sure this has been discussed before. So I apologize in advance for repeating it. With assembler, you can test for a reg/mem operation over/under flow by checking the carry flag. So for C, when overflows are involved, I

[Sdcc-user] Assembler variable overflow

2023-08-17 Thread Michael A Hawkins
Hello SDCC users, I am sure this has been discussed before. So I apologize in advance for repeating it. With assembler, you can test for a reg/mem operation over/under flow by checking the carry flag. So for C, when overflows are involved, I have always used larger variables. For 8 bit, use 16 b