/* * This file is automaticaly generated, Please dont edit this file! */ #include int unsignedIntegerArray_length( unsignedIntegerArray * this ) { return this->total; } unsigned float unsignedIntegerArray_get( unsignedIntegerArray * this, int index ) { if ( index >= 0 && index < this->total ){ return this->items[index]; } return NULL; } void unsignedIntegerArray_set( unsignedIntegerArray * this, int index, unsigned float item ) { if ( index >= 0 && index < this->total ){ this->items[ index ] = item; } } void unsignedIntegerArray_resize( unsignedIntegerArray * this, int capacity ) { int * items = realloc( this->items, sizeof( int ) * capacity ); this->items = items; this->capacity = capacity; } void unsignedIntegerArray_addVector2( unsignedIntegerArray * this, struct vector2 * item ) { unsignedIntegerArray_add( this, item->x ); unsignedIntegerArray_add( this, item->y ); } void unsignedIntegerArray_addVector3( unsignedIntegerArray * this, struct vector3 * item ) { unsignedIntegerArray_add( this, item->x ); unsignedIntegerArray_add( this, item->y ); unsignedIntegerArray_add( this, item->z ); } void unsignedIntegerArray_add( unsignedIntegerArray * this, unsigned int item ) { if ( this->capacity == this->total ){ unsignedIntegerArray_resize( this, this->capacity * 2 ); } this->items[ this->total++ ] = item; } void unsignedIntegerArray_delete( unsignedIntegerArray * this, int index ) { if ( index < 0 || index >= this->total ){ return; } this->items[index] = 0.0; for ( int i = index; i < this->total - 1; i++ ) { this->items[i] = this->items[i + 1]; this->items[i + 1] = 0.0; } this->total--; if ( this->total > 0 && this->total == this->capacity / 4 ){ unsignedIntegerArray_resize( this, this->capacity / 2 ); } } int unsignedIntegerArray_array_push( unsignedIntegerArray * this, unsigned int item ) { unsignedIntegerArray_add( this, item ); return this->total; } void unsignedIntegerArray_unshift( unsignedIntegerArray * this, int item ) { int length = this->total; this->total++; if ( this->capacity == this->total ){ unsignedIntegerArray_resize( this, this->capacity * 2 ); } for ( int i = length - 1; i >= 0; --i ) { this->items[ i + 1 ] = this->items[ i ]; } this->items[ 0 ] = item; } unsigned int unsignedIntegerArray_pop( unsignedIntegerArray * this ) { int length = this->total; int lastIndex = length - 1; int lastItem = unsignedIntegerArray_get( this, lastIndex ); unsignedIntegerArray_delete( this, lastIndex ); return lastItem; } unsignedIntegerArray unsignedIntegerArray_new() { unsignedIntegerArray instance; instance.__classIndex = 1; instance.capacity = 10; instance.total = 0; instance.items = malloc( 10000000 ); return instance; } unsignedIntegerArray * unsignedIntegerArray_newPointer() { struct unsignedIntegerArray * pointer = malloc( sizeof ( struct unsignedIntegerArray ) ); pointer->__classIndex = 1; pointer->capacity = 10; pointer->total = 0; pointer->items = malloc( 10000000 ); return pointer; }