Replaced add64, add64u and add64ul with operators.
Change-Id: Ia537f83e15cb686f1b81b34d73596f4298b0a924
This commit is contained in:
		
							parent
							
								
									288e6864c8
								
							
						
					
					
						commit
						f1b0deacf3
					
				| @ -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; | ||||
| 
 | ||||
|  | ||||
| @ -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); | ||||
| 
 | ||||
|  | ||||
| @ -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; } | ||||
| 
 | ||||
|   } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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) {		\ | ||||
|  | ||||
| @ -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; | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -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; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -61,7 +61,7 @@ int do_read() | ||||
| 
 | ||||
| 	count -= chunk; | ||||
| 	off += chunk; | ||||
| 	pos = add64u(pos, chunk); | ||||
| 	pos += chunk; | ||||
|   } | ||||
| 
 | ||||
|   if (r < 0) | ||||
|  | ||||
| @ -64,7 +64,7 @@ cp_grant_id_t *grantp; | ||||
| 
 | ||||
| 	count -= r; | ||||
| 	off += r; | ||||
| 	pos = add64u(pos, r); | ||||
| 	pos += r; | ||||
|   } | ||||
| 
 | ||||
|   if (r < 0) | ||||
|  | ||||
| @ -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; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -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);  | ||||
|  | ||||
| @ -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) | ||||
|  | ||||
| @ -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);  | ||||
|  | ||||
| @ -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); | ||||
| 
 | ||||
|  | ||||
| @ -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. */ | ||||
|  | ||||
| @ -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; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Gerard
						Gerard