RMB operator +(RMB& s,double data) { unsigned int y=s.yuan+(int)data; unsigned int j=s.jf+(data-int(data))*100; while(j>100) { y++; j-=100; } return RMB(y,j); }
RMB operator +(RMB& s) //c=a+b { unsigned int y=yuan+s.yuan; unsigned int j=jf+s.jf; while(jf>100) { y++; j-=100; } return RMB(y,j); }
static inline int mvdev_check_rcfp(mvdev_connection_t * c) { int empty = 0; do { mvdev_channel_rc_fp * ch = c->channel_rc_fp; mv_rbuf * v = ch->recv_head_rbuf; volatile MVBUF_HEAD_FLAG_TYPE *head; volatile MVBUF_TAIL_FLAG_TYPE *tail; head = (MVBUF_HEAD_FLAG_TYPE *) v->base_ptr; if(0 != *head) { uint64_t head_val, tail_val, size, seq, type, last_recv; READ_RCFP_HEADER(*head, (&head_val), (&size), (&seq)); tail = (MVBUF_TAIL_FLAG_TYPE *) (v->base_ptr + size - sizeof(MVBUF_TAIL_FLAG_TYPE)); READ_RCFP_FOOTER(*tail, (&tail_val), (&type), (&last_recv)); if(MVDEV_LIKELY(tail_val == head_val)) { #ifndef DISABLE_RMB RMB(); #endif READ_RCFP_HEADER(*head, (&head_val), (&size), (&seq)); v->byte_len_data = v->byte_len = size - MV_RCFP_OVERHEAD; v->has_header = 1; v->rank = c->global_rank; v->seqnum = seq; v->transport = MVDEV_TRANSPORT_RCFP; *head = 0; if(MVDEV_UNLIKELY(++(ch->recv_head) >= viadev_num_rdma_buffer)) { ch->recv_head = 0; } ch->recv_head_rbuf = &(ch->recv_region->array[ch->recv_head]); if(MVDEV_LIKELY(MVDEV_PACKET_FP_CACHED_EAGER == type)) { v->data_ptr = v->base_ptr + sizeof(MVBUF_HEAD_FLAG_TYPE); /* need special processing for a cached eager */ mvdev_process_ack(c, last_recv); /* special code to know it is not normal */ v->has_header = 2; /* take a processing shortcut if we are the next packet * and there are no others waiting */ if(MVDEV_LIKELY(NULL == c->recv_window_head && v->seqnum == c->recv_window_start_seq)) { mvdev_recv_fast_eager(v, c); c->seqnum_next_toack = v->seqnum; INCREMENT_SEQ_NUM(&(c->recv_window_start_seq)); release_mv_rbuf(v); } else { mvdev_place_recvwin(c, v); } ACK_CREDIT_CHECK(c, v); } else { mvdev_process_recv(v); } return 1; } } else { empty = 1; } } while (!empty); return 0; }