// Move constructor ColumnBundle::ColumnBundle(ColumnBundle&& Y) { std::swap(ncols, Y.ncols); std::swap(col_length, Y.col_length); std::swap(qnum, Y.qnum); std::swap(basis, Y.basis); memMove((ManagedMemory&&)Y); //cannibalize Y's data }
/** Create space in the binary for count bytes starting at index. The memory in the new space is uninitialized. \param buf Initialized binary buffer. \param index Position to expand at. \param count Number of bytes to expand. */ void ur_binExpand( UBuffer* buf, int index, int count ) { ur_binReserve( buf, buf->used + count ); if( index < buf->used ) { uint8_t* mem = buf->ptr.b + index; memMove( mem + count, mem, buf->used - index ); } buf->used += count; }
/** Remove bytes from the binary. \param buf Initialized binary buffer. \param start Start index of erase. \param count Number of bytes to remove. */ void ur_binErase( UBuffer* buf, int start, int count ) { if( start >= buf->used ) return; if( (start + count) < buf->used ) { uint8_t* mem = buf->ptr.b + start; memMove( mem, mem + count, buf->used - start - count ); buf->used -= count; } else buf->used = start; }
err_t dstuCompressPoint(octet xpoint[], const dstu_params* params, const octet point[]) { err_t code; // состояние ec_o* ec; word* x; word* y; void* stack; // старт code = _dstuCreateEc(&ec, params, _dstuCompressPoint_deep); ERR_CALL_CHECK(code); // проверить входные указатели if (!memIsValid(point, 2 * ec->f->no) || !memIsValid(xpoint, ec->f->no)) { _dstuCloseEc(ec); return ERR_BAD_INPUT; } // раскладка состояния x = objEnd(ec, word); y = x + ec->f->n; stack = y + ec->f->n; // загрузить точку if (!qrFrom(x, point, ec->f, stack) || !qrFrom(y, point + ec->f->no, ec->f, stack)) { _dstuCloseEc(ec); return ERR_BAD_POINT; } // x == 0? if (wwIsZero(x, ec->f->n)) { _dstuCloseEc(ec); return ERR_OK; } // y <- y / x qrDiv(y, y, x, ec->f, stack); // xpoint <- x(point), xpoint_0 <- tr(y) memMove(xpoint, point, ec->f->no); xpoint[0] &= 0xFE; xpoint[0] |= gf2Tr(y, ec->f, stack); // завершение _dstuCloseEc(ec); return ERR_OK; }
// Move assignment matrix& matrix::operator=(matrix&& m1) { std::swap(nr, m1.nr); std::swap(nc, m1.nc); memMove((ManagedMemory&&)m1); return *this; }
// Move constructor matrix::matrix(matrix&& m1) { std::swap(nr, m1.nr); std::swap(nc, m1.nc); memMove((ManagedMemory&&)m1); }