summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-02-28 09:12:13 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-02-28 09:31:04 +0100
commitf71ccc345e7347b5913d198a147af281351f9db1 (patch)
tree9f8d032d5b5b8a121617bdc257c468944b800e5d /cpukit/libcsupport
parenttermios09: Test send callback (diff)
downloadrtems-f71ccc345e7347b5913d198a147af281351f9db1.tar.bz2
termios: Simplify some calculations
Use the modular arithmetic addition rule.
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r--cpukit/libcsupport/src/termios.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index d1058997f8..9eace2eeea 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -1533,8 +1533,7 @@ fillBufferQueue (struct rtems_termios_tty *tty)
c = tty->rawInBuf.theBuf[newHead];
tty->rawInBuf.Head = newHead;
- if(((tty->rawInBuf.Tail-newHead+tty->rawInBuf.Size)
- % tty->rawInBuf.Size)
+ if(((tty->rawInBuf.Tail - newHead) % tty->rawInBuf.Size)
< tty->lowwater) {
tty->flow_ctrl &= ~FL_IREQXOF;
/* if tx stopped and XON should be sent... */
@@ -1756,8 +1755,8 @@ rtems_termios_enqueue_raw_characters (void *ttyp, const char *buf, int len)
newTail = (oldTail + 1) % tty->rawInBuf.Size;
/* if chars_in_buffer > highwater */
- if ((tty->flow_ctrl & FL_IREQXOF) != 0 && (((newTail - head
- + tty->rawInBuf.Size) % tty->rawInBuf.Size) > tty->highwater)) {
+ if ((tty->flow_ctrl & FL_IREQXOF) != 0 && (((newTail - head) %
+ tty->rawInBuf.Size) > tty->highwater)) {
/* incoming data stream should be stopped */
tty->flow_ctrl |= FL_IREQXOF;
if ((tty->flow_ctrl & (FL_MDXOF | FL_ISNTXOF))