core_options &core_options::operator=(const core_options &rhs) { // ignore self-assignment if (this != &rhs) copyfrom(rhs); return *this; }
hash_collection::hash_collection(const hash_collection &src) : m_has_crc32(false), m_has_sha1(false), m_creator(NULL) { copyfrom(src); }
hash_collection &hash_collection::operator=(const hash_collection &src) { // ignore self-assignment if (this != &src) copyfrom(src); return *this; }
// ------------------ CBriefcase copy ---------------------- CBriefcase::CBriefcase(const CBriefcase &v) { invest = NULL; cur = NULL; best = NULL; NumItem = 0; MaxNumItem = 0; copyfrom(v); }
dTensorBase::dTensorBase(const dTensorBase& in, CopyMode::Enum copyMode) : size(in.size) { switch(copyMode) { // should make vec counted_ptr first //case CopyMode::SHALLOW: // vec(in.vec); // break; case CopyMode::DIMS: vec = new double[size]; break; case CopyMode::DEEP: eprintf("Delete this error message to enable CopyMode::DEEP."); vec = new double[size]; copyfrom(in); break; default: unsupported_value_error(copyMode); } }
core_options::core_options(const core_options &src) : m_entrylist(NULL), m_entrylist_tailptr(&m_entrylist) { copyfrom(src); }
core_options::core_options(const core_options &src) { copyfrom(src); }
void iterate(int size, char arr[20][20], char arr2[20][20], char lines[108][200]) { printf("size is %d \n", size); if (size % 2 == 0) { printf("2->3 transform \n"); int x; int y; for (x=0;x<size/2;x++){ for(y=0;y<size/2;y++){ printf("x, y = %d, %d\n", x,y); //grab a 2x2 square into "two" copyfrom(20, 2, arr, x*2, y*2, a2); //looking for match int l; for (l=0; l<108; l++) { if (lines[l][6]=='=') { parse2(lines[l],b2, b3); if (match(2, a2, b2)==1) { printf("match found \n"); copyto(3,20, b3, arr2,x*3,y*3); break; } } } } } size = (size/2)*3; } else if (size % 3 == 0) { printf("3->4 transform \n"); int x; int y; for (x=0;x<size/3;x++){ for(y=0;y<size/3;y++){ printf("x, y = %d, %d\n", x,y); //grab a 3x3 square into "three" copyfrom(20, 3, arr, x*3, y*3, a3); printf("three:\n"); printarr(3, a3); //looking for match int l; for (l=0; l<108; l++) { if (lines[l][6]!='=') { parse3(lines[l],b3, b4); if (match(3, a3, b3)==1) { /* printf("line > "); printf(lines[l]); printf("three2:\n"); printarr(3, b3); printf("four2:\n"); printarr(4, b4); printf("----\n\n"); */ printf("match!\n"); copyto(4,20, b4, arr2,x*4,y*4); break; } } } } } size = (size/3)*4; } return; }
void TSC_scalar::streamin(QBinTagReader &reader) { copyfrom(reader.read_double()); }
/*===========================================================================* * block_transfer * *===========================================================================*/ static int block_transfer(dev_t minor, /* minor device number */ int do_write, /* read or write? */ u64_t position, /* offset on device to read or write */ endpoint_t endpt, /* process doing the request */ iovec_t * iov, /* pointer to read or write request vector */ unsigned int nr_req, /* length of request vector */ int flags /* transfer flags */ ) { unsigned long counter; iovec_t *ciov; /* Current IO Vector */ struct device *dev; /* The device used */ struct sd_slot *slot; /* The sd slot the requests is pointed to */ vir_bytes io_size; /* Size to read/write to/from the iov */ vir_bytes io_offset; /* Size to read/write to/from the iov */ vir_bytes bytes_written; int r, blk_size, i; /* Get the current "device" geometry */ dev = block_part(minor); if (dev == NULL) { mmc_log_warn(&log, "Transfer requested on unknown device minor(%d)\n", minor); /* Unknown device */ return ENXIO; } mmc_log_trace(&log, "I/O on minor(%d) %s at 0x%016llx\n", minor, (do_write) ? "Write" : "Read", position); slot = get_slot(minor); assert(slot); if (slot->card.blk_size == 0) { mmc_log_warn(&log, "Request on a card with block size of 0\n"); return EINVAL; } if (slot->card.blk_size > COPYBUFF_SIZE) { mmc_log_warn(&log, "Card block size (%d) exceeds internal buffer size %d\n", slot->card.blk_size, COPYBUFF_SIZE); return EINVAL; } /* It is fully up to the driver to decide on restrictions for the * parameters of transfers, in those cases we return EINVAL */ if (position % slot->card.blk_size != 0) { /* Starting at a block boundary */ mmc_log_warn(&log, "Requests must start at a block boundary" "(start,block size)=(%016llx,%08x)\n", position, slot->card.blk_size); return EINVAL; } blk_size = slot->card.blk_size; bytes_written = 0; /* Are we trying to start reading past the end */ if (position >= dev->dv_size) { mmc_log_warn(&log, "start reading past drive size\n"); return 0; }; ciov = iov; /* do some more validation */ for (counter = 0; counter < nr_req; counter++) { assert(ciov != NULL); if (ciov->iov_size % blk_size != 0) { /* transfer a multiple of blk_size */ mmc_log_warn(&log, "Requests must start at a block boundary " "(start,block size)=(%016llx,%08x)\n", position, slot->card.blk_size); return EINVAL; } if (ciov->iov_size <= 0) { mmc_log_warn(&log, "Invalid iov size for iov %d of %d size\n", counter, nr_req, ciov->iov_size); return EINVAL; } ciov++; } ciov = iov; for (counter = 0; counter < nr_req; counter++) { /* Assume we are to transfer the amount of data given in the * input/output vector but ensure we are not doing i/o past * our own boundaries */ io_size = ciov->iov_size; io_offset = position + bytes_written; /* Check we are not reading/writing past the end */ if (position + bytes_written + io_size > dev->dv_size) { io_size = dev->dv_size - (position + bytes_written); }; mmc_log_trace(&log, "I/O %s request(%d/%d) iov(grant,size,iosize," "offset)=(%d,%d,%d,%d)\n", (do_write) ? "write" : "read", counter + 1, nr_req, ciov->iov_addr, ciov->iov_size, io_size, io_offset); /* transfer max one block at the time */ for (i = 0; i < io_size / blk_size; i++) { if (do_write) { /* Read io_size bytes from i/o vector starting * at 0 and write it to out buffer at the * correct offset */ r = copyfrom(endpt, ciov->iov_addr, i * blk_size, (vir_bytes) copybuff, blk_size); if (r != OK) { mmc_log_warn(&log, "I/O write error: %s iov(base,size)=(%d,%d)" " at offset=%d\n", strerror(_SIGN r), ciov->iov_addr, ciov->iov_size, io_offset); return EINVAL; } /* write a single block */ slot->host->write(&slot->card, (dev->dv_base / blk_size) + (io_offset / blk_size) + i, 1, copybuff); bytes_written += blk_size; } else { /* read a single block info copybuff */ slot->host->read(&slot->card, (dev->dv_base / blk_size) + (io_offset / blk_size) + i, 1, copybuff); /* Read io_size bytes from our data at the * correct offset and write it to the output * buffer at 0 */ r = copyto(endpt, ciov->iov_addr, i * blk_size, (vir_bytes) copybuff, blk_size); if (r != OK) { mmc_log_warn(&log, "I/O read error: %s iov(base,size)=(%d,%d)" " at offset=%d\n", strerror(_SIGN r), ciov->iov_addr, ciov->iov_size, io_offset); return EINVAL; } bytes_written += blk_size; } } ciov++; } return bytes_written; }
options::options(const options &src) { copyfrom(src); }
const Field& Field::operator=(const Field& a) { copyfrom(a); return *this; }
Field::Field(const Field& a) //Constructor 3 { ne = 0; dat_vec = 0; hashtable = 0; copyfrom(a); }
hash_collection::hash_collection(const hash_collection &src) { copyfrom(src); }