Commit 59ea100d by Alan Mishchenko

Variable timeframe abstraction.

parent d931de7f
...@@ -56,6 +56,12 @@ static inline void veci_push (veci* v, int e) ...@@ -56,6 +56,12 @@ static inline void veci_push (veci* v, int e)
// int newsize = v->cap * 2;//+1; // int newsize = v->cap * 2;//+1;
int newsize = (v->cap < 4) ? v->cap * 2 : (v->cap / 2) * 3; int newsize = (v->cap < 4) ? v->cap * 2 : (v->cap / 2) * 3;
v->ptr = ABC_REALLOC( int, v->ptr, newsize ); v->ptr = ABC_REALLOC( int, v->ptr, newsize );
if ( v->ptr == NULL )
{
printf( "Failed to realloc memory from %.1f Mb to %.1f Mb.\n",
1.0 * v->cap / (1<<20), 1.0 * newsize / (1<<20) );
fflush( stdout );
}
v->cap = newsize; } v->cap = newsize; }
v->ptr[v->size++] = e; v->ptr[v->size++] = e;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment