summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-06-09 14:13:38 +0000
committer[email protected] <[email protected]>2011-06-09 14:13:38 +0000
commit3126b45da6067816282fdbdd2c50f9485e3d2bb7 (patch)
treef1aab625f75b03229bf1df73b25c447776a0666a
parent0513333a10933fbbd9f04e88455e0e2d08d29a4e (diff)
Remove divide instructions.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1477 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--src/ipc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ipc.c b/src/ipc.c
index 664237ef4c..cc09d8cd31 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -1398,7 +1398,7 @@ rt_err_t rt_mb_send_wait (rt_mailbox_t mb, rt_uint32_t value, rt_int32_t timeout
mb->msg_pool[mb->in_offset] = value;
/* increase input offset */
++ mb->in_offset;
- mb->in_offset %= mb->size;
+ if (mb->in_offset > mb->size) mb->in_offset = 0;
/* increase message entry */
mb->entry ++;
@@ -1529,7 +1529,7 @@ rt_err_t rt_mb_recv (rt_mailbox_t mb, rt_uint32_t* value, rt_int32_t timeout)
/* increase output offset */
++mb->out_offset;
- mb->out_offset %= mb->size;
+ if (mb->out_offset > mb->size) mb->out_offset = 0;
/* decrease message entry */
mb->entry --;