]> Zhao Yanbai Git Server - minix.git/commitdiff
Replaced add64, add64u and add64ul with operators. 40/1140/2
authorGerard <gvdschoot@gmail.com>
Mon, 11 Nov 2013 18:17:03 +0000 (19:17 +0100)
committerBen Gras <ben@minix3.org>
Wed, 13 Nov 2013 13:11:33 +0000 (13:11 +0000)
Change-Id: Ia537f83e15cb686f1b81b34d73596f4298b0a924

21 files changed:
drivers/fbd/rule.c
drivers/floppy/floppy.c
drivers/random/main.c
include/minix/u64.h
include/timers.h
kernel/arch/earm/arch_clock.c
kernel/system/do_getinfo.c
lib/libhgfs/time.c
lib/libsffs/read.c
lib/libsffs/write.c
lib/libsys/arch/i386/profile.c
lib/libsys/arch/i386/tsc_util.c
lib/libvboxfs/attr.c
servers/ext2/read.c
servers/iso9660fs/read.c
servers/iso9660fs/super.c
servers/mfs/read.c
servers/vfs/open.c
servers/vfs/read.c
test/test53.c
usr.sbin/mkfs.mfs/mkfs.c

index 81ebc6620fdff0ead7809120edc7c9289ddd2885..f5c140b1790958a45cf122f901642842390357f5 100644 (file)
@@ -92,7 +92,7 @@ static int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag)
         */
 
        /* Ranges must overlap (start < pos+size && end > pos). */
-       if (cmp64(rule->start, add64u(pos, size)) >= 0 ||
+       if (cmp64(rule->start, pos + size) >= 0 ||
                        (cmp64u(rule->end, 0) && cmp64(rule->end, pos) <= 0))
                return FALSE;
 
index 43f15f402c3304f9e2d34828688225abf5ee1436..f62790f11e9f97f58614929381e68d0d0606a50b 100644 (file)
@@ -500,7 +500,7 @@ static ssize_t f_transfer(
        /* Which block on disk and how close to EOF? */
        if (position >= dv_size) return(total);         /* At EOF */
        if (position + nbytes > dv_size) nbytes = dv_size - position;
-       block = div64u(add64ul(f_dv->dv_base, position), SECTOR_SIZE);
+       block = div64u(f_dv->dv_base + position, SECTOR_SIZE);
 
        if ((nbytes & SECTOR_MASK) != 0) return(EINVAL);
 
index 18ed36d34dcf5977fc1f4fe26d714a39b5acf08f..4202648f64c2eae41afb432ec649fe7dbcb70dc7 100644 (file)
@@ -202,7 +202,7 @@ static int r_transfer(
        }
 
        /* Book the number of bytes transferred. */
-       position= add64u(position, count);
+       position += count;
        if ((iov->iov_size -= count) == 0) { iov++; nr_req--; vir_offset = 0; }
 
   }
index a03cae37c6c992db498be36875d11083a17dcf66..5411aa399b865bc802439d26d53615a3234398af 100644 (file)
@@ -9,21 +9,6 @@
 
 #include <limits.h>
 
-static inline u64_t add64(u64_t i, u64_t j)
-{
-       return i + j;
-}
-
-static inline u64_t add64u(u64_t i, unsigned j)
-{
-       return i + j;
-}
-
-static inline u64_t add64ul(u64_t i, unsigned long j)
-{
-       return i + j;
-}
-
 static inline int bsr64(u64_t i)
 {
        int index;
index dcb5ba4907356dcdde255c96bd0994b5e99e11eb..683dca92385e31e11e8df43559f13314b4d26f71 100644 (file)
@@ -89,12 +89,12 @@ clock_t tmrs_settimer(timer_t **tmrs, timer_t *tp, clock_t exp_time,
        if(_cum_instances == 0) {                               \
                RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
         }                                                      \
-       _next_cum_spent = add64(_cum_spenttime, _dt);           \
+       _next_cum_spent = _cum_spenttime + _dt;                 \
        if(ex64hi(_next_cum_spent)) {                           \
                PRINT_STATS(_cum_spenttime, _cum_instances);    \
                RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
        }                                                       \
-       _cum_spenttime = add64(_cum_spenttime, _dt);            \
+       _cum_spenttime += _dt;                                  \
        _cum_instances++;                                       \
        _cum_dt = sub64(_endtime, _cum_starttime);              \
        if(cmp64(_cum_dt, make64(0, 120)) > 0) {                \
index 4d2c2164fc97adb5571d3237d8a0cc6bf07846c4..754c6ccdebc0d0ab316ea1aad55c7afc2b38d8c4 100644 (file)
@@ -68,14 +68,12 @@ void context_stop(struct proc * p)
        p->p_cycles += tsc_delta;
 
        if(kbill_ipc) {
-               kbill_ipc->p_kipc_cycles =
-                       add64(kbill_ipc->p_kipc_cycles, tsc_delta);
+               kbill_ipc->p_kipc_cycles += tsc_delta;
                kbill_ipc = NULL;
        }
 
        if(kbill_kcall) {
-               kbill_kcall->p_kcall_cycles =
-                       add64(kbill_kcall->p_kcall_cycles, tsc_delta);
+               kbill_kcall->p_kcall_cycles += tsc_delta;
                kbill_kcall = NULL;
        }
 
index fef7ce5a441ed2477c085e8e5ff1b73dbd7b9e4b..94818c89d2d69b3d36a5c7574bcb600c0235283f 100644 (file)
@@ -30,8 +30,7 @@ static void update_idle_time(void)
        idl->p_cycles = make64(0, 0);
 
        for (i = 0; i < CONFIG_MAX_CPUS ; i++) {
-               idl->p_cycles = add64(idl->p_cycles,
-                               get_cpu_var(i, idle_proc).p_cycles);
+               idl->p_cycles += get_cpu_var(i, idle_proc).p_cycles;
        }
 }
 
index 1dc80605691e0e0beff5edc1b4d3aa974f35d2cb..ba3085f140895b3077316590aa5b350232d9e92a 100644 (file)
@@ -33,8 +33,8 @@ void time_put(struct timespec *tsp)
   u64_t hgfstime;
 
   if (tsp != NULL) {
-       hgfstime = add64ul(mul64u(tsp->tv_sec, 10000000), tsp->tv_nsec / 100);
-       hgfstime = add64(hgfstime, time_offset);
+       hgfstime = mul64u(tsp->tv_sec, 10000000) + (tsp->tv_nsec / 100);
+       hgfstime += time_offset;
 
        RPC_NEXT32 = ex64lo(hgfstime);
        RPC_NEXT32 = ex64hi(hgfstime);
index e34bd28d2ee0261cfc903d1fea7e8f4d85cd2505..d27d9839dfbdfbf2c6d54b5c8d6c5175c94475d2 100644 (file)
@@ -61,7 +61,7 @@ int do_read()
 
        count -= chunk;
        off += chunk;
-       pos = add64u(pos, chunk);
+       pos += chunk;
   }
 
   if (r < 0)
index bf70038a72f2ce0c4eb9580ade6c36b907732f64..bd571a3374922cb681ad55c9197a4a0decedef4f 100644 (file)
@@ -64,7 +64,7 @@ cp_grant_id_t *grantp;
 
        count -= r;
        off += r;
-       pos = add64u(pos, r);
+       pos += r;
   }
 
   if (r < 0)
index 51c90f711581f59584b1295a991dcc7029d80f57..6f795c1fcfec68af31f927fca087bbc78c93670f 100644 (file)
@@ -192,9 +192,8 @@ void procexit (char *UNUSED(name))
 
   /* Calculate "small" difference. */
   spent = sub64(stop, cprof_stk[cprof_stk_top].start_2);
-  cprof_stk[cprof_stk_top].slot->cycles =
-       add64(cprof_stk[cprof_stk_top].slot->cycles, 
-               sub64(spent, cprof_stk[cprof_stk_top].spent_deeper));
+  cprof_stk[cprof_stk_top].slot->cycles +=
+       sub64(spent, cprof_stk[cprof_stk_top].spent_deeper);
 
   /* Clear spent_deeper for call level we're leaving. */
   cprof_stk[cprof_stk_top].spent_deeper = ((u64_t)(0));
@@ -220,8 +219,7 @@ void procexit (char *UNUSED(name))
   spent = sub64(stop, cprof_stk[cprof_stk_top].start_1);
   cprof_stk_top--;                                     /* decrease stack */
   if (cprof_stk_top >= 0)          /* don't update non-existent level -1 */
-       cprof_stk[cprof_stk_top].spent_deeper =
-               add64(cprof_stk[cprof_stk_top].spent_deeper, spent);
+       cprof_stk[cprof_stk_top].spent_deeper += spent;
   cprof_locked = 0;
 }
 
index 87b2b8c1c00030b61e313a44fd9802d8bd8870b7..9897efcad312f2d622694a5e0751694be1e9c506 100644 (file)
@@ -63,7 +63,7 @@ micro_delay(u32_t micros)
        CALIBRATE;
 
        /* We have to know when to end the delay. */
-       end = add64(now, mul64u(micros, calib_mhz));
+       end = now + mul64u(micros, calib_mhz);
 
        /* If we have to wait for at least one HZ tick, use the regular
         * tickdelay first. Round downwards on purpose, so the average
index 6017748a84eda3d369993192e467f433044c790c..cef9c8a82981afc82f54e728a32031adbe6ebc00 100644 (file)
@@ -21,7 +21,7 @@ static u64_t
 set_time(struct timespec *tsp)
 {
 
-       return add64u(mul64u(tsp->tv_sec, 1000000000), tsp->tv_nsec);
+       return mul64u(tsp->tv_sec, 1000000000) + tsp->tv_nsec;
 }
 
 /*
index f095a4579db86e727348db81eba3e0f7b14352e3..4988d95455c4c9794872dbf59e1a13b3feb08222 100644 (file)
@@ -185,9 +185,9 @@ int fs_breadwrite(void)
          if (rdwt_err < 0) break;
 
          /* Update counters and pointers. */
-         nrbytes -= chunk;             /* bytes yet to be read */
-         cum_io += chunk;              /* bytes read so far */
-         position = add64ul(position, chunk);  /* position within the file */
+         nrbytes -= chunk;     /* bytes yet to be read */
+         cum_io += chunk;      /* bytes read so far */
+         position += chunk;    /* position within the file */
   }
 
   fs_m_out.RES_SEEK_POS_LO = ex64lo(position);
index f43bd1c7c7f99b1985a9445b83ac5d698dcd594a..045fddfe3d8cd47bd199758551abe9df68e9f758 100644 (file)
@@ -119,9 +119,9 @@ int fs_bread(void)
     if (rdwt_err < 0) break;
     
     /* Update counters and pointers. */
-    nrbytes -= chunk;          /* bytes yet to be read */
-    cum_io += chunk;           /* bytes read so far */
-    position= add64ul(position, chunk);        /* position within the file */
+    nrbytes -= chunk;  /* bytes yet to be read */
+    cum_io += chunk;   /* bytes read so far */
+    position += chunk; /* position within the file */
   }
   
   fs_m_out.RES_SEEK_POS_LO = ex64lo(position); 
index 0df66b113a4811039895b9676980062f3bf1be35..3f9bcfab80de89a3f7b70c02c6f67a7060019b5e 100644 (file)
@@ -108,7 +108,7 @@ int read_vds(
       /* I dont need to save anything about it */
       vol_ok = TRUE;
 
-    offset = add64u(offset,ISO9660_MIN_BLOCK_SIZE);
+    offset += ISO9660_MIN_BLOCK_SIZE;
   }
 
   if (vol_ok == FALSE)
index fa41d27b85a1e6821226e640c8e3c8aa04ca32b0..704776261c44e52779cda4bab3e4123129da2ef5 100644 (file)
@@ -194,9 +194,9 @@ int fs_breadwrite(void)
          if (lmfs_rdwt_err() < 0) break;
 
          /* Update counters and pointers. */
-         nrbytes -= chunk;             /* bytes yet to be read */
-         cum_io += chunk;              /* bytes read so far */
-         position = add64ul(position, chunk);  /* position within the file */
+         nrbytes -= chunk;     /* bytes yet to be read */
+         cum_io += chunk;      /* bytes read so far */
+         position += chunk;    /* position within the file */
   }
   
   fs_m_out.RES_SEEK_POS_LO = ex64lo(position); 
index 2d0dde2000a461d70ab2332ab611938941c3edeb..3b1b5b9b0a9cf9d33b922f7309c6c2b038b0142a 100644 (file)
@@ -615,7 +615,7 @@ int actual_lseek(message *m_out, int seekfd, int seekwhence, off_t offset)
   }
 
   if (offset >= 0)
-       newpos = add64ul(pos, offset);
+       newpos = pos + offset;
   else
        newpos = sub64ul(pos, -offset);
 
index a96f07066588cc3b5b6252d238618f06cf36ee4c..173e4ee003f6dc646f424a63e487ed8808070bf3 100644 (file)
@@ -181,7 +181,7 @@ int read_write(struct fproc *rfp, int rw_flag, struct filp *f,
                   suspend_reopen);
        if (r >= 0) {
                cum_io = r;
-               position = add64ul(position, r);
+               position += r;
                r = OK;
        }
   } else if (S_ISBLK(vp->v_mode)) {    /* Block special files. */
index 6f946a688c59c605cdd93ecb93da5132d2692ca6..d7d14e5839b401db3acfe26cded4c85ac2078dd6 100644 (file)
@@ -148,8 +148,8 @@ static void testmul(void)
                if (cmp64(mul64(mul64(i, j), k), mul64(i, mul64(j, k))) != 0) ERR;
 
                /* left and right distributivity */
-               if (cmp64(mul64(add64(i, j), k), add64(mul64(i, k), mul64(j, k))) != 0) ERR;
-               if (cmp64(mul64(i, add64(j, k)), add64(mul64(i, j), mul64(i, k))) != 0) ERR;
+               if (cmp64(mul64(i + j, k), mul64(i, k) + mul64(j, k)) != 0) ERR;
+               if (cmp64(mul64(i, j + k), mul64(i, j) + mul64(i, k)) != 0) ERR;
        }
 }
 
@@ -241,7 +241,7 @@ static void testdiv(void)
        }
 
        /* check results using i = q j + r and r < j */
-       if (cmp64(i, add64(mul64(q, j), r)) != 0) ERR;
+       if (cmp64(i, mul64(q, j) + r) != 0) ERR;
        if (cmp64(r, j) >= 0) ERR;
 }
 
index b5256cb9824167b5d6cbbae6c444980601049c2a..36f506cf441ebf0a15fad48f62912d32b0201630 100644 (file)
@@ -556,7 +556,7 @@ sizeup(char * device)
   d = div64u(bytes, block_size);
   rem = rem64u(bytes, block_size);
 
-  resize = add64u(mul64u(d, block_size), rem);
+  resize = mul64u(d, block_size) + rem;
   if(cmp64(resize, bytes) != 0) {
        /* Assume block_t is unsigned */
        d = (block_t)(-1ul);