Re: Implement D3DXMatrixStack_Push

2008-04-09 Thread Stefan Dösinger
Am Mittwoch, 9. April 2008 22:41:25 schrieb H. Verbeet: > On 09/04/2008, Stefan Dösinger <[EMAIL PROTECTED]> wrote: > > You usually grow the memory by a factor of the old size because this > > reduces the number of needed grows. So growing the stack is an O(log(n)) > > instead of O(n), which is a h

Re: Implement D3DXMatrixStack_Push

2008-04-09 Thread H. Verbeet
On 09/04/2008, Stefan Dösinger <[EMAIL PROTECTED]> wrote: > You usually grow the memory by a factor of the old size because this reduces > the number of needed grows. So growing the stack is an O(log(n)) instead of > O(n), which is a huge difference. > No, the amortized time per push is O(1). The

Re: Implement D3DXMatrixStack_Push

2008-04-09 Thread Stefan Dösinger
Am Mittwoch, 9. April 2008 10:54:37 schrieb David Adam: > On 08/04/2008, David Adam > > wrote: > >* +This->current = This->current +1; > > *>* +HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->matrix, > (This->current +1) * sizeof(D

Implement D3DXMatrixStack_Push

2008-04-09 Thread David Adam
On 08/04/2008, David Adam http://www.winehq.org/mailman/listinfo/wine-patches>> wrote: >* +This->current = This->current +1; *>* +HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->matrix, (This->current +1) * sizeof(D3DXMATRIX) ); *>* +if ( This->matrix == NULL ) return E_OUTOFMEMOR

Re: d3dx8 [6/7] Implement D3DXMatrixStack_Push

2008-04-09 Thread tony . wasserka
> > +This->current = This->current +1; > > +HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->matrix, > > (This->current +1) * sizeof(D3DXMATRIX) ); > > +if ( This->matrix == NULL ) return E_OUTOFMEMORY; > Aside from being a bit suboptimal (doing a realloc on every push), > this p

Re: Implement D3DXMatrixStack_Push

2008-04-09 Thread H. Verbeet
On 09/04/2008, David Adam <[EMAIL PROTECTED]> wrote: > This would increase the size of the stack exponentially. Would it be better > to do this: > > Take a stack_size_reference (for instance 32 items) > When This->current =32, then increase the size of the stack of > stack_size_reference (that is 6

Re: d3dx8 [6/7] Implement D3DXMatrixStack_Push

2008-04-08 Thread H. Verbeet
On 08/04/2008, David Adam <[EMAIL PROTECTED]> wrote: > +This->current = This->current +1; > +HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->matrix, > (This->current +1) * sizeof(D3DXMATRIX) ); > +if ( This->matrix == NULL ) return E_OUTOFMEMORY; Aside from being a bit suboptima