summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/assess.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/mbbsd/assess.c b/mbbsd/assess.c
index 059fc078..46a1a6f9 100644
--- a/mbbsd/assess.c
+++ b/mbbsd/assess.c
@@ -4,18 +4,12 @@
/* do (*num) + n, n is integer. */
inline static void inc(unsigned char *num, int n)
{
- if (n > 0){
- if (SALE_MAXVALUE - *num < n)
- (*num) = SALE_MAXVALUE;
- else
- (*num) += n;
- }
- else {
- if (*num < n)
- (*num) = 0;
- else
- (*num) -= n;
- }
+ if (n >= 0 && SALE_MAXVALUE - *num < n)
+ (*num) = SALE_MAXVALUE;
+ else if (n < 0 && *num < -n)
+ (*num) = 0;
+ else
+ (*num) += n;
}
void inc_goodpost(int uid, int num)