Exemple #1
0
double ProblemAproximace1(Problem* prb, Stav* s, char** str) {
  double sum=0.0;
  double min=UINT_MAX;
  Set* m = SetInvertCopy(s->m);
  SetRemove(m, s->v); SetAdd(m, 0); //kam muze jit
  *str = calloc(m->count*PROBLEM_BACKTRACK, sizeof(char)); strcpy(*str, "");
  int* filter = SetArray(m);
  int i,x,y,next=-1;
  x=s->v;
  while(m->count>0) {
    for(i=0; i<m->count; i++) {
      y=filter[i];
      if(y==0 && m->count>1) continue; //do startovniho vrcholu az nakonec
      min = UINT_MAX; next=-1;
      if(prb->g->mat[x][y]>=0 && prb->g->mat[x][y]<min) {
        min=prb->g->mat[x][y];
        next = y;
      }
    }
    sum+=min;
    if(next<0) break;
    SetRemove(m, next);
    x = next;
    free(filter); filter = SetArray(m);
    sprintf(*str, "%s%i ", *str, next);
  }
  SetDestroy(m); free(filter);
  return sum;
}
Exemple #2
0
void Particles::InitParticle()
{
	uint3 numCells = mparams.cellNum;

	for (int z = 0; z < numCells.z; z++)
	{
		for (int y = 0; y < numCells.y; y++)
		{
			for (int x = 0; x < numCells.x; x++)
			{
				int i = (z * numCells.y * numCells.x) + (y * numCells.x) + x;

				if (i < numParticles)
				{
					pos[i * 4] = (mparams.radius* 2.f * x *0.9f);
					pos[i * 4 + 1] = (mparams.radius* 2.f * y*0.9f);
					pos[i * 4 + 2] = (mparams.radius* 2.f * z *0.9f);
					pos[i * 4 + 3] = 1.0f;

					vel[i * 4] = 0;
					vel[i * 4 + 1] = 0;
					vel[i * 4 + 2] = 0;
					vel[i * 4 + 3] = 0;
				}
			}
		}
	}

	SetArray(POSITION, pos, 0, numParticles);
	SetArray(VELOCITY, vel, 0, numParticles);
}
Exemple #3
0
void TBValue::SetFromStringAuto(const char *str, SET set)
{
	if (!str)
		SetNull();
	else if (is_number_only(str))
	{
		if (is_number_float(str))
			SetFloat((float)atof(str));
		else
			SetInt(atoi(str));
	}
	else if (is_start_of_number(str) && contains_non_trailing_space(str))
	{
		// If the number has nontrailing space, we'll assume a list of numbers (example: "10 -4 3.5")
		SetNull();
		if (TBValueArray *arr = new TBValueArray)
		{
			TBStr tmpstr;
			char *s3;
			if (tmpstr.Set(str))
			{
				char * pch = strtok_r(tmpstr, ", ", &s3);
				while (pch)
				{
					if (TBValue *new_val = arr->AddValue())
						new_val->SetFromStringAuto(pch, SET_NEW_COPY);
					pch = strtok_r(NULL, ", ", &s3);
				}
			}
			SetArray(arr, SET_TAKE_OWNERSHIP);
		}
	}
	else if (*str == '[')
	{
		SetNull();
		if (TBValueArray *arr = new TBValueArray)
		{
			assert(!"not implemented! Split out the tokenizer code above!");
			SetArray(arr, SET_TAKE_OWNERSHIP);
		}
	}
	else
	{
		SetString(str, set);
		return;
	}
	// We didn't set as string, so we might need to deal with the passed in string data.
	if (set == SET_TAKE_OWNERSHIP)
	{
		// Delete the passed in data
		TBValue tmp;
		tmp.SetString(str, SET_TAKE_OWNERSHIP);
	}
}
Exemple #4
0
TBValue::TBValue(TYPE type)
	: m_packed_init(0)
{
	switch (type)
	{
	case TYPE_NULL:
		SetNull();
		break;
	case TYPE_STRING:
		SetString("", SET_AS_STATIC);
		break;
	case TYPE_FLOAT:
		SetFloat(0);
		break;
	case TYPE_INT:
		SetInt(0);
		break;
	case TYPE_OBJECT:
		SetObject(nullptr);
		break;
	case TYPE_ARRAY:
		if (TBValueArray *arr = new TBValueArray())
			SetArray(arr, SET_TAKE_OWNERSHIP);
		break;
	default:
		assert(!"Not implemented!");
	};
}
Exemple #5
0
void TBValue::TakeOver(TBValue &source_value)
{
	if (source_value.m_packed.type == TYPE_STRING)
		SetString(source_value.val_str, source_value.m_packed.allocated ? SET_TAKE_OWNERSHIP : SET_NEW_COPY);
	else if (source_value.m_packed.type == TYPE_ARRAY)
		SetArray(source_value.val_arr, source_value.m_packed.allocated ? SET_TAKE_OWNERSHIP : SET_NEW_COPY);
	else
		*this = source_value;
	source_value.m_packed.type = TYPE_NULL;
}
//following allows files from Lucas to be read in. expects indexX, Y, Z, vectorX, Y, Z format.
void readVorticitiesFile(double *vort, FILE *inputFile)
  {
  int i,j,k; //array indices
  double dx,dy,dz; //values of vector as put into vorticities matrix
  float x,y,z; //values of vector as read in
  while(fscanf(inputFile, "%d %d %d %e %e %e", &i, &j, &k, &x, &y, &z) != EOF)
    {
    dx =  x;
    dy =  y;
    dz =  z;
    double thisNorm = sqrt(dx*dx + dy*dy + dz*dz);
    if (thisNorm > maxNorm)
      {
      maxNorm = thisNorm;
      }
    SetArray(vort, dx, i, j, k, 0); 
    SetArray(vort, dy, i, j, k, 1); 
    SetArray(vort, dz, i, j, k, 2); 
    }
  //fprintf(stderr, "%e", maxNorm);
  }
Exemple #7
0
// vrati vsechny mozne predchudce (pro pouziti pri rekonstrukci reseni z closed stavu)
SArray* ProblemPredchudci(Problem* prb, Stav* s) {
  if(s->m->count==0) return NULL;
  SArray* p = SArrayCreate(ProblemStavCompare);
  int* filter = SetArray(s->m);
  Stav* n;
  int i; for(i=0; i<s->m->count; i++) {
    n = ProblemStavCreate(prb,filter[i],s->m);
    SetRemove(n->m, filter[i]);
    SArrayAdd(p, (void*) n);
  }
  free(filter);
  return p;
}
Exemple #8
0
double ProblemHeuristika3(Problem* prb, Stav* s) {
  //soucet minimalnich ohodnoceni hran vedoucich do vrcholu do kterych obch. cest. jeste nevesel 
  double sum=0;
  double min;
  Set* m2 = SetInvertCopy(s->m); //kam muze jit
  Set* m1 = SetCopy(m2); //odkud muze jit
  SetRemove(m1, s->v); SetAdd(m1, 0);
  int* filter1 = SetArray(m1);
  int* filter2 = SetArray(m2);
  int i,j,x,y;
  for(i=0; i<m1->count; i++) {
    x=filter1[i];
    min = UINT_MAX;
    for(j=0; j<m2->count; j++) {
      y=filter2[j];
      if(prb->g->mat[y][x]>=0 && prb->g->mat[y][x]<min)
          min=prb->g->mat[y][x];
      }
    if(min!=UINT_MAX) sum+=min;
  }
  SetDestroy(m1); SetDestroy(m2); free(filter1); free(filter2);
  return sum;
}
Exemple #9
0
void TBValue::Copy(const TBValue &source_value)
{
	if (source_value.m_packed.type == TYPE_STRING)
		SetString(source_value.val_str, SET_NEW_COPY);
	else if (source_value.m_packed.type == TYPE_ARRAY)
		SetArray(source_value.val_arr, SET_NEW_COPY);
	else if (source_value.m_packed.type == TYPE_OBJECT)
	{
		assert(!"We can't copy objects! The value will be nulled!");
		SetObject(nullptr);
	}
	else
	{
		SetNull();
		memcpy(this, &source_value, sizeof(TBValue));
	}
}
// May Trigger GC, but parameter value will be protected
HRESULT CLR_RT_HeapBlock_Queue::Enqueue( CLR_RT_HeapBlock* value )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_RT_HeapBlock_Array* array    = GetArray();
    CLR_INT32               size     = GetSize();
    CLR_INT32               tail     = GetTail();
    CLR_INT32               capacity = array->m_numOfElements;

    if(size == capacity)
    {
        // Set new capacity
        CLR_RT_HeapBlock newArrayHB;
        
        // Protect value from GC, in case CreateInstance triggers one
        CLR_RT_HeapBlock valueHB; valueHB.SetObjectReference( value );
        CLR_RT_ProtectFromGC gc( valueHB );

        capacity *= 2;

        TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( newArrayHB, capacity, g_CLR_RT_WellKnownTypes.m_Object ));

        array = newArrayHB.DereferenceArray();

        CopyTo( array, 0 );

        tail = size;

        SetArray( array );
        SetHead ( 0     );
        SetTail ( tail  );
    }

    ((CLR_RT_HeapBlock*)array->GetElement( tail ))->SetObjectReference( value );

    SetTail( (tail + 1) % capacity );

    SetSize( size + 1 );

    TINYCLR_NOCLEANUP();
}
Exemple #11
0
int CSortListCtrl::AddItem( LPCTSTR pszText, ... )
{
	const int iIndex = InsertItem( GetItemCount(), pszText );
	LPTSTR* arrpsz = new LPTSTR[ m_iNumColumns ];
	COLORREF * clrText = new COLORREF[ m_iNumColumns ];
	COLORREF * clrBak= new COLORREF[ m_iNumColumns ];

	arrpsz[ 0 ] = new TCHAR[ lstrlen( pszText ) + 1 ];
	clrText[ 0 ] = crWindowText;
	clrBak[ 0 ] = crWindow;
	(void)lstrcpy( arrpsz[ 0 ], pszText );
	

 	va_list list;
	va_start( list, pszText );


	//insert sub item  and set subitem data
	for( int iColumn = 1; iColumn < m_iNumColumns; iColumn++ )
	{
		pszText = va_arg( list, LPCTSTR );
		ASSERT_VALID_STRING( pszText );
		VERIFY( CListCtrl::SetItem( iIndex, iColumn, LVIF_TEXT, pszText, 0, 0, 0, 0 ) );

		arrpsz[ iColumn ] = new TCHAR[ lstrlen( pszText ) + 1 ];
		clrText[ iColumn ] = crWindowText;
		clrBak[ iColumn ] = crWindow;
		(void)lstrcpy( arrpsz[ iColumn ], pszText );
	}

	va_end( list );

	VERIFY( SetArray( iIndex, arrpsz,clrText,clrBak ) );

	return iIndex;
}
    vtkSmartPointer<vtkPolyData> VoxelCarving::createVisualHull(
        const double isolevel) const {

        // create vtk visualization pipeline from voxel grid
        auto spoints = vtkSmartPointer<vtkStructuredPoints>::New();
        auto vdim    = static_cast<int>(voxel_dim_);
        spoints->SetDimensions(vdim, vdim, vdim);
        spoints->SetSpacing(params_.voxel_width, params_.voxel_height,
                            params_.voxel_depth);
        spoints->SetOrigin(params_.start_x, params_.start_y, params_.start_z);

        auto farray = vtkSmartPointer<vtkFloatArray>::New();
        auto vsize  = static_cast<vtkIdType>(voxel_size_);
        farray->SetNumberOfValues(vsize);
        farray->SetArray(vox_array_.get(), vsize, 1);
        spoints->GetPointData()->SetScalars(farray);

        // create iso surface with marching cubes
        auto mc_source = vtkSmartPointer<vtkMarchingCubes>::New();
#if VTK_MAJOR_VERSION < 6
        mc_source->SetInput(spoints);
#else
        mc_source->SetInputData(spoints);
#endif
        mc_source->SetNumberOfContours(1);
        mc_source->SetValue(0, isolevel);

        // calculate surface normals
        auto surface_normals = vtkSmartPointer<vtkPolyDataNormals>::New();
        surface_normals->SetInputConnection(mc_source->GetOutputPort());
        surface_normals->SetFeatureAngle(60.0);
        surface_normals->ComputePointNormalsOn();
        surface_normals->Update();

        return surface_normals->GetOutput();
    }
void CBasicTreeSquareDrawer::DrawQuad (int x,int y)
{
	int treesX = td->treesX;
	CBasicTreeDrawer::TreeSquareStruct* tss=&td->trees[y*treesX+x];

	float3 dif;
	dif.x=camera->pos.x-(x*SQUARE_SIZE*TREE_SQUARE_SIZE + SQUARE_SIZE*TREE_SQUARE_SIZE/2);
	dif.y=0;
	dif.z=camera->pos.z-(y*SQUARE_SIZE*TREE_SQUARE_SIZE + SQUARE_SIZE*TREE_SQUARE_SIZE/2);
	float dist=dif.Length();
	dif/=dist;
	
	if(dist<SQUARE_SIZE*TREE_SQUARE_SIZE*treeDistance*2 && dist>SQUARE_SIZE*TREE_SQUARE_SIZE*(treeDistance)){//far trees
		tss->lastSeenFar=gs->frameNum;
		if(!tss->farDisplist || dif.dot(tss->viewVector)<0.97){
			va=GetVertexArray();
			va->Initialize();
			tss->viewVector=dif;
			if(!tss->farDisplist)
				tss->farDisplist=glGenLists(1);
			float3 up(0,1,0);
			float3 side=up.cross(dif);

			for(std::map<int,CBasicTreeDrawer::TreeStruct>::iterator ti=tss->trees.begin();ti!=tss->trees.end();++ti){
				CBasicTreeDrawer::TreeStruct* ts=&ti->second;
				if(ts->type<8){
					float3 base(ts->pos);
					float height=MAX_TREE_HEIGHT;
					float width=MAX_TREE_HEIGHT*0.3;

					SetArray(0,0,base+side*width);
					SetArray(0,0.25,base+side*width+float3(0,height,0));
					SetArray(0.5f,0.25,base-side*width+float3(0,height,0));
					SetArray(0.5f,0,base-side*width);
				} else {
					float3 base(ts->pos);
					float height=MAX_TREE_HEIGHT;
					float width=MAX_TREE_HEIGHT*0.3;

					SetArray(0,0.25,base+side*width);
					SetArray(0,0.5,base+side*width+float3(0,height,0));
					SetArray(0.25f,0.5,base-side*width+float3(0,height,0));
					SetArray(0.25f,0.25,base-side*width);
				}
			}
			glNewList(td->trees[y*treesX+x].farDisplist,GL_COMPILE);
			va->DrawArrayT(GL_QUADS);
			glEndList();
		}
		if(dist>SQUARE_SIZE*TREE_SQUARE_SIZE*(treeDistance*2-1)){
			float trans=(SQUARE_SIZE*TREE_SQUARE_SIZE*treeDistance*2-dist)/(SQUARE_SIZE*TREE_SQUARE_SIZE);
			glEnable(GL_BLEND);
			glColor4f(1,1,1,trans);
			glAlphaFunc(GL_GREATER,(SQUARE_SIZE*TREE_SQUARE_SIZE*treeDistance*2-dist)/(SQUARE_SIZE*TREE_SQUARE_SIZE*2));
		} else {
			glColor4f(1,1,1,1);			
			glDisable(GL_BLEND);
			glAlphaFunc(GL_GREATER,0.5f);
		}
		glCallList(tss->farDisplist);
	}
	
	if(dist<SQUARE_SIZE*TREE_SQUARE_SIZE*treeDistance){	//midle distance trees
		tss->lastSeen=gs->frameNum;
		if(!tss->displist){
			va=GetVertexArray();
			va->Initialize();
			tss->displist=glGenLists(1);

			for(std::map<int,CBasicTreeDrawer::TreeStruct>::iterator ti=tss->trees.begin();ti!=tss->trees.end();++ti){
				CBasicTreeDrawer::TreeStruct* ts=&ti->second;
				if(ts->type<8){
					float3 base(ts->pos);
					float height=MAX_TREE_HEIGHT;
					float width=MAX_TREE_HEIGHT*0.3;

					SetArray(0,0,base+float3(width,0,0));
					SetArray(0,0.25,base+float3(width,height,0));
					SetArray(0.5f,0.25,base+float3(-width,height,0));
					SetArray(0.5f,0,base+float3(-width,0,0));

					SetArray(0,0,base+float3(0,0,width));
					SetArray(0,0.25,base+float3(0,height,width));
					SetArray(0.5f,0.25,base+float3(0,height,-width));
					SetArray(0.5f,0,base+float3(0,0,-width));

					width*=1.2f;
					SetArray(0.5,0,base+float3(width,height*0.25,0));
					SetArray(0.5,0.25,base+float3(0,height*0.25,-width));
					SetArray(1,0.25,base+float3(-width,height*0.25,0));
					SetArray(1,0,base+float3(0,height*0.25,width));
				} else {
					float3 base(ts->pos);
					float height=MAX_TREE_HEIGHT;
					float width=MAX_TREE_HEIGHT*0.3;

					SetArray(0,0.25,base+float3(width,0,0));
					SetArray(0,0.5,base+float3(width,height,0));
					SetArray(0.25f,0.5,base+float3(-width,height,0));
					SetArray(0.25f,0.25,base+float3(-width,0,0));

					SetArray(0.25f,0.25,base+float3(0,0,width));
					SetArray(0.25f,0.5,base+float3(0,height,width));
					SetArray(0.5f,0.5,base+float3(0,height,-width));
					SetArray(0.5f,0.25,base+float3(0,0,-width));

					width*=1.2f;
					SetArray(0.5,0.25,base+float3(width,height*0.3,0));
					SetArray(0.5,0.5,base+float3(0,height*0.3,-width));
					SetArray(1,0.5,base+float3(-width,height*0.3,0));
					SetArray(1,0.25,base+float3(0,height*0.3,width));
				}
			}
			glNewList(tss->displist,GL_COMPILE);
			va->DrawArrayT(GL_QUADS);
			glEndList();
		}
		glColor4f(1,1,1,1);			
		glDisable(GL_BLEND);
		glAlphaFunc(GL_GREATER,0.5f);
		glCallList(tss->displist);
	}
}
// This does all allocation/reallocation of the array.
// It also will compact down to N - good for things that might grow a lot
// at times,  but usually are smaller, like JS deferred GC releases.
PRBool nsVoidArray::SizeTo(PRInt32 aSize)
{
  PRUint32 oldsize = GetArraySize();
  PRBool isOwner = IsArrayOwner();
  PRBool hasAuto = HasAutoBuffer();

  if (aSize == (PRInt32) oldsize)
    return PR_TRUE; // no change

  if (aSize <= 0)
  {
    // free the array if allocated
    if (mImpl)
    {
      if (isOwner)
      {
        free(reinterpret_cast<char *>(mImpl));
        if (hasAuto) {
          static_cast<nsAutoVoidArray*>(this)->ResetToAutoBuffer();
        }
        else {
          mImpl = nsnull;
        }
      }
      else
      {
        mImpl->mCount = 0; // nsAutoVoidArray
      }
    }
    return PR_TRUE;
  }

  if (mImpl && isOwner)
  {
    // We currently own an array impl. Resize it appropriately.
    if (aSize < mImpl->mCount)
    {
      // XXX Note: we could also just resize to mCount
      return PR_TRUE;  // can't make it that small, ignore request
    }

    char* bytes = (char *) realloc(mImpl,SIZEOF_IMPL(aSize));
    Impl* newImpl = reinterpret_cast<Impl*>(bytes);
    if (!newImpl)
      return PR_FALSE;

#if DEBUG_VOIDARRAY
    if (mImpl == newImpl)
      ADD_TO_STATS(GrowInPlace,oldsize);
    ADD_TO_STATS(AllocedOfSize,SIZEOF_IMPL(aSize));
    if (aSize > mMaxSize)
    {
      ADD_TO_STATS(NumberOfSize,SIZEOF_IMPL(aSize));
      if (oldsize)
        SUB_FROM_STATS(NumberOfSize,oldsize);
      mMaxSize = aSize;
      if (mIsAuto)
      {
        ADD_TO_STATS(MaxAuto,SIZEOF_IMPL(aSize));
        SUB_FROM_STATS(MaxAuto,oldsize);
      }
    }
#endif
    SetArray(newImpl, aSize, newImpl->mCount, PR_TRUE, hasAuto);
    return PR_TRUE;
  }

  if ((PRUint32) aSize < oldsize) {
    // No point in allocating if it won't free the current Impl anyway.
    return PR_TRUE;
  }

  // just allocate an array
  // allocate the exact size requested
  char* bytes = (char *) malloc(SIZEOF_IMPL(aSize));
  Impl* newImpl = reinterpret_cast<Impl*>(bytes);
  if (!newImpl)
    return PR_FALSE;

#if DEBUG_VOIDARRAY
  ADD_TO_STATS(AllocedOfSize,SIZEOF_IMPL(aSize));
  if (aSize > mMaxSize)
  {
    ADD_TO_STATS(NumberOfSize,SIZEOF_IMPL(aSize));
    if (oldsize && !mImpl)
      SUB_FROM_STATS(NumberOfSize,oldsize);
    mMaxSize = aSize;
  }
#endif
  if (mImpl)
  {
#if DEBUG_VOIDARRAY
    ADD_TO_STATS(MaxAuto,SIZEOF_IMPL(aSize));
    SUB_FROM_STATS(MaxAuto,0);
    SUB_FROM_STATS(NumberOfSize,0);
    mIsAuto = PR_TRUE;
#endif
    // We must be growing an nsAutoVoidArray - copy since we didn't
    // realloc.
    memcpy(newImpl->mArray, mImpl->mArray,
                  mImpl->mCount * sizeof(mImpl->mArray[0]));
  }

  SetArray(newImpl, aSize, mImpl ? mImpl->mCount : 0, PR_TRUE, hasAuto);
  // no memset; handled later in ReplaceElementAt if needed
  return PR_TRUE;
}
Exemple #15
0
// This does all allocation/reallocation of the array.
// It also will compact down to N - good for things that might grow a lot
// at times,  but usually are smaller, like JS deferred GC releases.
bool nsVoidArray::SizeTo(int32_t aSize)
{
  uint32_t oldsize = GetArraySize();

  if (aSize == (int32_t) oldsize)
    return true; // no change

  if (aSize <= 0)
  {
    // free the array if allocated
    if (mImpl)
    {
      free(reinterpret_cast<char *>(mImpl));
      mImpl = nullptr;
    }
    return true;
  }

  if (mImpl)
  {
    // We currently own an array impl. Resize it appropriately.
    if (aSize < mImpl->mCount)
    {
      // XXX Note: we could also just resize to mCount
      return true;  // can't make it that small, ignore request
    }

    char* bytes = (char *) realloc(mImpl,SIZEOF_IMPL(aSize));
    Impl* newImpl = reinterpret_cast<Impl*>(bytes);
    if (!newImpl)
      return false;

#if DEBUG_VOIDARRAY
    if (mImpl == newImpl)
      ADD_TO_STATS(GrowInPlace,oldsize);
    ADD_TO_STATS(AllocedOfSize,SIZEOF_IMPL(aSize));
    if (aSize > mMaxSize)
    {
      ADD_TO_STATS(NumberOfSize,SIZEOF_IMPL(aSize));
      if (oldsize)
        SUB_FROM_STATS(NumberOfSize,oldsize);
      mMaxSize = aSize;
      if (mIsAuto)
      {
        ADD_TO_STATS(MaxAuto,SIZEOF_IMPL(aSize));
        SUB_FROM_STATS(MaxAuto,oldsize);
      }
    }
#endif
    SetArray(newImpl, aSize, newImpl->mCount);
    return true;
  }

  if ((uint32_t) aSize < oldsize) {
    // No point in allocating if it won't free the current Impl anyway.
    return true;
  }

  // just allocate an array
  // allocate the exact size requested
  char* bytes = (char *) malloc(SIZEOF_IMPL(aSize));
  Impl* newImpl = reinterpret_cast<Impl*>(bytes);
  if (!newImpl)
    return false;

#if DEBUG_VOIDARRAY
  ADD_TO_STATS(AllocedOfSize,SIZEOF_IMPL(aSize));
  if (aSize > mMaxSize)
  {
    ADD_TO_STATS(NumberOfSize,SIZEOF_IMPL(aSize));
    if (oldsize && !mImpl)
      SUB_FROM_STATS(NumberOfSize,oldsize);
    mMaxSize = aSize;
  }
#endif
  if (mImpl)
  {
#if DEBUG_VOIDARRAY
    ADD_TO_STATS(MaxAuto,SIZEOF_IMPL(aSize));
    SUB_FROM_STATS(MaxAuto,0);
    SUB_FROM_STATS(NumberOfSize,0);
    mIsAuto = true;
#endif
    // We must be growing an nsAutoVoidArray - copy since we didn't
    // realloc.
    memcpy(newImpl->mArray, mImpl->mArray,
                  mImpl->mCount * sizeof(mImpl->mArray[0]));
  }

  SetArray(newImpl, aSize, mImpl ? mImpl->mCount : 0);
  // no memset; handled later in ReplaceElementAt if needed
  return true;
}
Exemple #16
0
CVector::CVector(float *values)
{
	SetArray(values);
	init();
}
Exemple #17
0
LJValue::LJValue(const LJArray& arr) : _type(LJ_NULL)
{
	SetArray(arr);
}
Exemple #18
0
LJValue& LJValue::operator=( const LJArray& arr )
{
	SetArray(arr);
	return *this;
}