diff options
Diffstat (limited to 'mbbsd/assess.c')
-rw-r--r-- | mbbsd/assess.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/mbbsd/assess.c b/mbbsd/assess.c index 02498263..059fc078 100644 --- a/mbbsd/assess.c +++ b/mbbsd/assess.c @@ -1,20 +1,21 @@ #include "bbs.h" +/* do (*num) + n, n is integer. */ inline static void inc(unsigned char *num, int n) { - if (SALE_MAXVALUE - *num >= n) - (*num) += n; - else - (*num) = SALE_MAXVALUE; -} - -inline static void dec(unsigned char *num, int n) -{ - if (*num < n) - (*num) -= n; - else - (*num) = 0; + if (n > 0){ + if (SALE_MAXVALUE - *num < n) + (*num) = SALE_MAXVALUE; + else + (*num) += n; + } + else { + if (*num < n) + (*num) = 0; + else + (*num) -= n; + } } void inc_goodpost(int uid, int num) |