Пример #1
0
char *getDecodedMessage(const char *inputCodeFile, const char *key, int *status) {
    FILE *file = fopen(inputCodeFile, "r");
    if (file == NULL) {
        *status = INPUT_FILE_NOT_FOUND;
        return NULL;
    }
    char *decodedMessage = allocate(sizeof(char));
    char input;
    int position;
    int reallocValue = 1;
    int count = 0;

    while (true) {
        if (count == reallocValue) {
            reallocValue *= 2;
            decodedMessage = reallocate(decodedMessage, sizeof(char) * reallocValue);
        }
        int readStatus = fscanf(file, "[%d]", &position);
        if (readStatus == 1) {
            int index = position < 0 ? position * -1 : position;
            char value = key[index - 1];
            input = position < 0 ? toupper(value) : value;
        } else if (readStatus == EOF) {
            break;
        } else {
            fscanf(file, "%c", &input);
        }
        decodedMessage[count] = input;
        count++;
    }
    decodedMessage = (char*) reallocate(decodedMessage, sizeof(char) * (count + 1));
    decodedMessage[count] = '\0';
    fclose(file);
    return decodedMessage;
}
Пример #2
0
/* Determine the size of the input files. Seekable files are simply
 * measured; non-seekable files are read completely and stored in
 * memory.
 */
static void measureobjects(void)
{
    FILE *srcfile;
    char *p;
    int i, n;

    for (i = 0 ; i < objectcount ; ++i) {
	srcfile = fopen(objects[i].filename, "rb");
	if (!srcfile)
	    fail("%s: %s", objects[i].filename, strerror(errno));
	if (fseek(srcfile, 0, SEEK_END) != -1) {
	    objects[i].size = ftell(srcfile);
	    fclose(srcfile);
	    continue;
	}
	if (errno != ESPIPE)
	    fail("%s: %s", objects[i].filename, strerror(errno));
	objects[i].size = 0;
	p = NULL;
	for (;;) {
	    p = reallocate(p, objects[i].size + BUFSIZ);
	    n = fread(p + objects[i].size, 1, BUFSIZ, srcfile);
	    objects[i].size += n;
	    if (n < BUFSIZ) {
		if (ferror(srcfile))
		    fail("%s: %s", objects[i].filename, strerror(errno));
		break;
	    }
	}
	objects[i].data = reallocate(p, objects[i].size);
	fclose(srcfile);
    }
}
Пример #3
0
char *preprocessKey(const char *inputMessageFile, int *status) {
    FILE *file = fopen(inputMessageFile, "r");
    if (file == NULL) {
        *status = KEY_FILE_NOT_FOUND;
        return NULL;
    }

    char *key = (char*) allocate(sizeof(char));
    int reallocValue = 1;
    int count = 0;
    char input;

    while ((input = (char) fgetc(file)) != EOF) {
        if (reallocValue == count) {
            reallocValue *= 2;
            key = (char*) reallocate(key, sizeof(char) * reallocValue);
        }
        if (isalpha(input)) {
            key[count] = isupper(input) ? (char) tolower(input) : input;
            count++;
        }
    }
    key = reallocate(key, sizeof(char) * (count + 1));
    key[count] = '\0';
    fclose(file);
    return key;
}
Пример #4
0
void TBScrollBoxImpl::refresh() {
    Requisition req;
    scrollbox_->request(req);
    start_ = 0;
    reallocate();
    redraw();
}
Пример #5
0
void Array::addAt( Object& toAdd, int atIndex )

// Summary -----------------------------------------------------------------
//
//      Adds the given object to the array at the given index.  If there
//      is an object already at that index, destroys the object.
//
// Parameters
//
//      toAdd
//
//      The object we are to add to the array.  Once the object is
//      added, it is owned by the array.
//
//      atIndex
//
//      The index at which to add the object.
//
// End ---------------------------------------------------------------------
{

	if( atIndex > upperbound )
    {
		reallocate( atIndex - lowerbound + 1 );
    }

    if ( theArray[ atIndex ] != ZERO )
    {
        delete theArray[ atIndex ];
        itemsInContainer--;
    }
	theArray[ atIndex ] = &toAdd;
	itemsInContainer++;
}
Пример #6
0
/* Reads in one line of source code and run it through the partial
 * preprocessor. The return value is zero if the file has reached the
 * end or if the file can't be read.
 */
static int readline_buf(CparsePP *ppp, const char *inbuf)
{
    int size, i = 1;
    int prev, ch;

    ch = inbuf[0];
    if (ch == '\0')
	return 0;
    prev = '\0';
    for (size = 0 ; ch != '\0' ; ++size) {
		if (ch == '\n' && prev != '\\')
		    break;
		if (size + 1 == ppp->linealloc) {
			ppp->linealloc *= 2;
			ppp->line = reallocate(ppp->line, ppp->linealloc);
		}
		ppp->line[size] = ch;
		prev = ch;
		ch = inbuf[i++];
    }
    ppp->endline = ch != '\0';
    ppp->line[size] = '\0';

    seq(ppp);

    nextline(ppp->cl, NULL);
    return 1;
}
Пример #7
0
/* Reads in one line of source code and run it through the partial
 * preprocessor. The return value is zero if the file has reached the
 * end or if the file can't be read.
 */
static int readline(CparsePP *ppp, FILE *infile)
{
    int size;
    int prev, ch;

    ch = fgetc(infile);
    if (ch == EOF)
	return 0;
    prev = EOF;
    for (size = 0 ; ch != EOF ; ++size) {
	if (ch == '\n' && prev != '\\')
	    break;
	if (size + 1 == ppp->linealloc) {
	    ppp->linealloc *= 2;
	    ppp->line = reallocate(ppp->line, ppp->linealloc);
	}
	ppp->line[size] = ch;
	prev = ch;
	ch = fgetc(infile);
    }
    if (ferror(infile)) {
	error(errFileIO);
	return 0;
    }
    ppp->endline = ch != EOF;
    ppp->line[size] = '\0';

    seq(ppp);

    nextline(ppp->cl, NULL);
    return 1;
}
Пример #8
0
/* Adds an address to the collection. addr is the address, offset is
 * the (presumed) offset within the memory segment, size is the size
 * of the chunk of memory starting at that address, and name is the
 * name associated with that chunk. The largest chunk in that memory
 * address will determine which name is used to name the memory
 * segment.
 */
void recordaddress(long address, long offset, long size, char const *name)
{
    static int allocated = 0;
    long base;
    int i;

    base = address - offset;
    for (i = 0 ; i < addrcount ; ++i)
	if (addrs[i].address == base)
	    break;
    if (i == addrcount) {
	if (addrcount == allocated) {
	    allocated = allocated ? 2 * allocated : 4;
	    addrs = reallocate(addrs, allocated * sizeof *addrs);
	    memset(addrs + addrcount, 0,
		   (allocated - addrcount) * sizeof *addrs);
	}
	++addrcount;
	addrs[i].address = base;
    }
    ++addrs[i].count;
    if (!*addrs[i].name || addrs[i].maxchunk < size) {
	strcpy(addrs[i].name, name);
	addrs[i].maxchunk = size;
    }
    if (!addrs[i].from || addrs[i].from > address)
	addrs[i].from = address;
    if (addrs[i].to < address + size)
	addrs[i].to = address + size;
}
Пример #9
0
// Read one file header block. Returns:
//   -1 ... this was the last block
//    0 ... there is at least one more block left
//    1 ... error occured during reading the block
// Arguments:
//   f         ... pointer to file for reading
//   debugMode ... debug messages flag
//   fileName  ... name of the file
//   buf       ... pointer to header buffer,
//                 enlarged (reallocated) for current block
//   bufOffset ... pointer to buffer size, increased for current block size
int readHeaderBlock(FILE *f, int debugMode, const char *fileName, char **buf,
        int *bufOffset)
{
    char *tmpBuf;
    int error, blockHeader[blockHeaderSize], swap;

    // Get size of file header block.
    swap = readBlockHeader(f, fileName, debugMode, blockHeader, sizeof(char));
    if(swap < 0) return 1;    // Error.

    // Allocate space for buffer.
    tmpBuf = reallocate(debugMode, *buf,
            (*bufOffset + blockHeader[0] + 1) * sizeof(char));
    if(tmpBuf == NULL) return 1;    // Error.
    *buf = tmpBuf;


    // Read file header block.
    error = readBlockData(f, fileName, debugMode, *buf + *bufOffset, bufOffset,
            sizeof(char), blockHeader[0], 0);
    if(error == 1) return 1;    // Error.
    (*buf)[*bufOffset] = 0;

    // Read trailer of file header block.
    error = readBlockTrailer(f, fileName, debugMode, swap,
            blockHeader[blockHeaderSize - 1]);
    if(error == 1) return 1;    // Error.

    if(strstr(*buf, "$&%#")) return -1;    // End of block.

    return 0;    // There is more.
}
Пример #10
0
/*
 * Implementation of stdlib realloc.
 */
void * realloc(void *ptr, size_t size) {
    AllocUnit *au, *newAU;
    size_t paddedSize;

    if (size == 0) {
        free(ptr);
        return NULL;
    }
    paddedSize = padSize(size);
    if (!init()) {
        errno = ENOMEM;
        return NULL;
    }

    au = findAU(startHeap, (uintptr_t) ptr); 
    
    if (au == NULL || ptr == NULL) {
        return malloc(size);
    }

    newAU = reallocate(au, paddedSize);
    if (newAU == NULL) {
        errno = ENOMEM;
        return NULL;
    }
    if (debugMalloc()) {
        printf("MALLOC: realloc(%p,%zu)    =>   (ptr=%p, size=%zu)\n",ptr,
                size,newAU->memLoc,newAU->size); 
    }
    return newAU->memLoc;
}
Пример #11
0
/*
 * new_set() allocates another structure for a new set in the sets array and
 * increments the cur_set to index into the sets array for the new set.
 */
__private_extern__
void
new_set(void)
{
    long i;

	if(cur_set + 2 > nsets){
	    sets = reallocate(sets,
			      (nsets + NSETS_INCREMENT) * sizeof(struct set));
	    for(i = 0; i < NSETS_INCREMENT; i++){
		memset(sets + nsets + i, '\0', sizeof(struct set));
		sets[nsets + i].link_edit_common_object =
			allocate(sizeof(struct object_file));
		memset(sets[nsets + i].link_edit_common_object, '\0',
			sizeof(struct object_file));
		sets[nsets + i].link_edit_section_maps =
			allocate(sizeof(struct section_map));
		memset(sets[nsets + i].link_edit_section_maps, '\0',
			sizeof(struct section_map));
		sets[nsets + i].link_edit_common_section =
			allocate(sizeof(struct section));
		memset(sets[nsets + i].link_edit_common_section, '\0',
		       sizeof(struct section));
	    }
	    nsets += NSETS_INCREMENT;
	}
	cur_set++;
}
Пример #12
0
static void delete_ssh( const char *cmd )
{
    if ( !cmd || !cmd[0] ) return ;

    int curr = -1;
    unsigned int index = 0;
    char **retv = NULL;

    /**
     * This happens in non-critical time (After launching app)
     * It is allowed to be a bit slower.
     */
    char *path = allocate( strlen( cache_dir ) + strlen( SSH_CACHE_FILE )+3 );
    sprintf( path, "%s/%s", cache_dir, SSH_CACHE_FILE );
    FILE *fd = fopen ( path, "r" );

    if ( fd != NULL ) {
        char buffer[1024];
        while ( fgets( buffer,1024,fd ) != NULL ) {
            retv = reallocate( retv, ( index+2 )*sizeof( char* ) );
            buffer[strlen( buffer )-1] = '\0';
            retv[index] = strdup( buffer );
            retv[index+1] = NULL;

            if ( strcasecmp( retv[index], cmd ) == 0 ) {
                curr = index;
            }

            index++;
        }

        fclose( fd );
    }

    /**
     * Write out the last 25 results again.
     */
    fd = fopen ( path, "w" );

    if ( fd ) {

        for ( int i = 0; i < ( int )index && i < 20; i++ ) {
            if ( i != curr ) {
                fputs( retv[i], fd );
                fputc( '\n', fd );
            }
        }

        fclose( fd );
    }

    for ( int i=0; retv != NULL && retv[i] != NULL; i++ ) {
        free( retv[i] );
    }

    free( retv );

    free( path );

}
Пример #13
0
		//! Appends a string of the length l to this string.
		void stringc::append(const stringc& other, u32 length)
		{
			bool selfAppending = false;

			//handle self-appending
			if (this == &other)
				selfAppending = true;

			if (!selfAppending)
				other.Monitor->enter();
			Monitor->enter();

			IRR_ASSERT((other.Used - 1) > length);

			if (Used + length > Allocated)
				reallocate(Used + length);

			--Used;

			for (u32 l = 0; l < length; ++l)
				Array[l + Used] = other.Array[l];
			Used += length;

			// ensure proper termination
			Array[Used] = 0;
			++Used;

			if (!selfAppending)
				other.Monitor->exit();
			Monitor->exit();
		}
Пример #14
0
		//! Appends a char string to this string
		void stringc::append(const c8* const other)
		{
			Monitor->enter();

			IRR_ASSERT(other != 0);

			u32 len = 0;
			const c8* p = other;
			while (*p)
			{
				++len;
				++p;
			}

			if (Used + len > Allocated)
				reallocate(Used + len);

			--Used;
			++len;

			for (u32 l = 0; l < len; ++l)
				Array[l + Used] = *(other + l);

			Used += len;

			Monitor->exit();
		}
Пример #15
0
		//! Appends a string to this string
		void stringc::append(const stringc& other)
		{
			bool selfAppending = false;

			//handle self-appending
			if (this == &other)
				selfAppending = true;

			if (!selfAppending)
				other.Monitor->enter();
			Monitor->enter();

			--Used;
			u32 len = other.Used;

			if (Used + len > Allocated)
				reallocate(Used + len);

			for (u32 l = 0; l < len; ++l)
				Array[Used + l] = other.Array[l];

			Used += len;

			if (!selfAppending)
				other.Monitor->exit();
			Monitor->exit();
		}
Пример #16
0
/* Automatically reallocate storage for a buffer that has an unknown
 * final size.  To create a new accumulator, pass in old==NULL.  To
 * reuse an existing accumulator, pass it in as old.  The new desired
 * size in bytes is len.  If zerofill is non-zero, all bytes between
 * the old and new length will be zero filled.
 *
 * Call this every time before placing a new element in the
 * accumulator.  If you may place new elements non-sequentially, you
 * should set zerofill on every call for a given accumulator.
 *
 * If it's non-NULL, the argument 'old' points four bytes into an
 * allocated block. The four preceding bytes give the length of the
 * most recent allocation for that block. That's why we back up from
 * old to get the value for accumulator, which is a block of size
 * length+sizeof(unsigned int).
 */
void *
accumulator(void *old, unsigned int len, int zerofill)
{
    unsigned int *accumulator;     // points to length word, or NULL if a new accumulator
    unsigned int new_len;          // includes the length word
    unsigned int accum_length;     // includes the length word
    unsigned int old_accum_length; // includes the length word
    // The value stored in the length word includes the length word itself.

    // allocate something even if len==0
    new_len = (len ? len : 1) + sizeof(int);
    if (old == NULL) {
	accumulator = NULL;
	old_accum_length = sizeof(int);
    } else {
	accumulator = ((unsigned int *)old) - 1;
	old_accum_length = *accumulator;
    }
    if (new_len > old_accum_length) {
	accum_length = quantize_length(new_len);
	accumulator = (unsigned int *)reallocate(accumulator, accum_length);
	*accumulator = accum_length;
	if (zerofill) {
	    memset(((char *)accumulator)+old_accum_length, 0,
		   accum_length - old_accum_length);
	}
	return (void *)(accumulator+1);
    }
    return old;
}
Пример #17
0
template<class T> void Tuple<T>::append(const Tuple<T>& t) {
    int old_sz = sz;
    reallocate(t.size()+size());
    assert(alloc_sz >= sz);
    for(int i=0; i<t.sz; i++)
	data[i+old_sz] = t.data[i];
}
Пример #18
0
// ----------------------------------------------------------------------------
void ToolBar::init()
{
    Editor* editor = Editor::getEditor();
    path icons = editor->getIconsLoc();
    m_bar      = editor->getGUIEnv()->addToolBar();
    m_bar->setMinSize(dimension2du(0,50));

    buttonInit(0,  TBI_NEW,         (icons + "new.png").c_str(),      _(L"New (ctrl+n)"));
    buttonInit(1,  TBI_OPEN,        (icons + "open.png").c_str(),     _(L"Open (ctrl+o)"));
    buttonInit(2,  TBI_SAVE,        (icons + "save.png").c_str(),     _(L"Save (ctrl+s)"));
    buttonInit(3,  TBI_EXPORT ,     (icons + "save_as.png").c_str(),  _(L"Export (ctrl+shift+s)"));
    buttonInit(4,  TBI_UNDO,        (icons + "undo.png").c_str(),     _(L"Undo (ctrl+z)"));
    buttonInit(5,  TBI_REDO,        (icons + "redo.png").c_str(),     _(L"Redo (ctrl+y)"));
    buttonInit(6,  TBI_SELECT,      (icons + "select.png").c_str(),   _(L"Select (shift+a)"));
    buttonInit(7,  TBI_MOVE,        (icons + "move.png").c_str(),     _(L"Move (shift+g)"));
    buttonInit(8,  TBI_ROTATE,      (icons + "rotate.png").c_str(),   _(L"Rotate (shift+r)"));
    buttonInit(9,  TBI_SCALE,       (icons + "scale.png").c_str(),    _(L"Scale (shift+s)"));
    buttonInit(10, TBI_DELETE,      (icons + "delete.png").c_str(),   _(L"Delete (del)"));
    buttonInit(11, TBI_CAM,         (icons + "cam1.png").c_str(),     _(L"Toggle camera mode (c)"));
    buttonInit(12, TBI_RECAM,       (icons + "cam2.png").c_str(),     _(L"Restore camera state (NUM1)"));
    buttonInit(13, TBI_DRIVELINE,   (icons + "spline.png").c_str(),   _(L"Select DriveLine (r)"));  
    buttonInit(14, TBI_HIDE_TERRAIN,(icons + "ht.png").c_str(),       _(L"Hide terrain (t)"));
    buttonInit(15, TBI_MUSIC,       (icons + "music.png").c_str(),    _(L"Music"));
    buttonInit(16, TBI_TRY,         (icons + "try.png").c_str(),      _(L"Try your track"));
    buttonInit(17, TBI_EXIT,        (icons + "exit.png").c_str(),     _(L"Quit (esc)"));

    reallocate();

} // init
Пример #19
0
MapBlock::MapBlock(Map *parent, v3s16 pos, IGameDef *gamedef, bool dummy):
		m_parent(parent),
		m_pos(pos),
		m_gamedef(gamedef),
		m_modified(MOD_STATE_WRITE_NEEDED),
		m_modified_reason("initial"),
		m_modified_reason_too_long(false),
		is_underground(false),
		m_lighting_expired(true),
		m_day_night_differs(false),
		m_day_night_differs_expired(true),
		m_generated(false),
		m_timestamp(BLOCK_TIMESTAMP_UNDEFINED),
		m_disk_timestamp(BLOCK_TIMESTAMP_UNDEFINED),
		m_usage_timer(0)
{
	data = NULL;
	if(dummy == false)
		reallocate();
	
#ifndef SERVER
	//mesh_mutex.Init();
	mesh = NULL;
#endif
}
Пример #20
0
void Grid::resize(QVector3D dimensions)
{
    m_nx = dimensions[0];
    m_ny = dimensions[1];
    m_nz = dimensions[2];
    reallocate();
}
Пример #21
0
int 
vector_insert_one_ele(struct vector *v, void *data_in ,int insert_idx)
{
	int idx , ret;
	if (insert_idx > v->tot_cnt || insert_idx < 0){
		fprintf(stderr,"insert_idx is invalid \n");
		return  -1;
	}

	if (v->tot_cnt + 1 == v->capacity ) {
		ret = reallocate(v);
		if (-1 == ret) {
			fprintf(stderr,"reallocate is fail \n");
			return -1;
		}
	}
	/* everytime memcpy one struct avoid memory overlap */
	/*  
	char *tmp ;
	for (idx = v->tot_cnt ; idx >= insert_idx ;idx--) {
		tmp = (char *)v->start + (idx * v->ele_size);
		memcpy((tmp + v->ele_size), tmp , v->ele_size);
	}
	*/
	char *cur = (char *)v->start + (insert_idx * v->ele_size);
	char *next = cur + v->ele_size;
	int size = (v->tot_cnt - insert_idx )*v->ele_size; 
	memmove(next,cur,size); /*this function avoid memory overlap*/
	memcpy(cur, data_in, v->ele_size );
	/*update the vector struct */
	v->tot_cnt += 1;
	v->end = (char *)v->end + (v->ele_size);
	
	return 0;	
}
Пример #22
0
void auxVectorResize(Vector* v, u4 size) {
  u4 oldSize = v->size;
  reallocate(v, size);
  if(oldSize < size) {
    memset(v->array + oldSize, 0, sizeof(AuxValue) * (size - oldSize));
  }
}
Пример #23
0
MapBlock::MapBlock(Map *parent, v3s16 pos, IGameDef *gamedef, bool dummy):
		heat_last_update(0),
		humidity_last_update(0),
		m_uptime_timer_last(0),
		m_parent(parent),
		m_pos(pos),
		m_gamedef(gamedef),
		m_modified(MOD_STATE_CLEAN),
		is_underground(false),
		m_day_night_differs(false),
		m_generated(false),
		m_disk_timestamp(BLOCK_TIMESTAMP_UNDEFINED),
		m_usage_timer(0)
{
	heat = 0;
	humidity = 0;
	m_timestamp = BLOCK_TIMESTAMP_UNDEFINED;
	m_changed_timestamp = 0;
	m_day_night_differs_expired = true;
	m_lighting_expired = true;
	m_refcount = 0;
	data = NULL;
	//if(dummy == false)
		reallocate();

#ifndef SERVER
	mesh = NULL;
	mesh2 = mesh4 = mesh8 = mesh16 = nullptr;
	mesh_size = 0;
#endif
	m_next_analyze_timestamp = 0;
	m_abm_timestamp = 0;
	content_only = CONTENT_IGNORE;
}
Пример #24
0
void push(void *obj)
{
  TRACE1("push(%p)\n",obj);
  assert(stack_len <= stack_alloced);
  assert(stack_bottom >= stack);
  if (stack_remaining == 0) {
    if (stack_bottom > stack) {
      TRACE0("move to bottom\n");
      memmove(stack, stack_bottom, stack_len * sizeof(*stack));
      stack_remaining += stack_bottom - stack;
      stack_bottom = stack;
    } else {
      TRACE1("realloc from %lu\n", stack_alloced);
      stack_remaining += stack_alloced + 1;
      stack_alloced = (stack_alloced + 1) << 1;
      stack = reallocate(stack, stack_alloced * sizeof(void *));
      stack_bottom = stack;
      assert(stack != NULL);
    }
  }
  
  stack_bottom[stack_len++] = obj;
  stack_bottom[stack_len] = NULL;
  stack_remaining--;
}
Пример #25
0
void Integer::sub(const Integer& a, const Integer& b) {
  assert(this != &a);
  assert(this != &b);
#ifdef GINV_INTEGER_ALLOCATOR
  reallocate(max(abs(a.mMpz._mp_size), abs(b.mMpz._mp_size)) + 1);
#endif // GINV_INTEGER_ALLOCATOR
  mpz_sub(&mMpz, &a.mMpz, &b.mMpz);
}
		HardwareIsoVertexShadow::ProducerQueueAccess::ProducerQueueAccess (
			boost::unique_lock< boost::shared_mutex > && lock, 
			BuilderQueue *& pBuilderQueue, 
			LOD * pResolution, const Touch3DFlags enStitches
		)
		:	ConcurrentProducerConsumerQueueBase(reallocate(pBuilderQueue, pResolution, enStitches)), 
			_lock(static_cast< boost::unique_lock<boost::shared_mutex> && > (lock))
		{}
Пример #27
0
AuxValue auxVectorPop(Vector* v) {
  u4 sz = v->size;
  assert(sz && "can't pop from empty vector");
  --sz;
  AuxValue val = v->array[sz];
  reallocate(v, sz);
  return val;
}
Пример #28
0
/*----------------------------------------------DelimList::suppress_shortrefs-+
| Suppress all shortrefs (SHORTREF NONE)                                      |
+----------------------------------------------------------------------------*/
bool DelimList::suppress_shortrefs()
{
   if (!reallocate(iCountDelim - iCountShortref)) {
      return false;
   }
   iCountShortref = 0;
   return true;
}
Пример #29
0
template<class T> void Tuple<T>::join(Tuple<T>& t) {
    int old_sz = sz;
    reallocate(t.size()+size());
    assert(alloc_sz >= sz);
    for(int i=0; i<t.sz; i++)
	data[i+old_sz] = t.data[i];
    t.clear();
}
Пример #30
0
void Integer::mult(const Integer& a, const Integer& b) {
  assert(this != &a);
  assert(this != &b);
#ifdef GINV_INTEGER_ALLOCATOR
  reallocate(abs(a.mMpz._mp_size) + abs(b.mMpz._mp_size));
#endif // GINV_INTEGER_ALLOCATOR
  mpz_mul(&mMpz, &a.mMpz, &b.mMpz);
}