Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7885 → Rev 7884

/programs/cmm/lib/collection.h
21,7 → 21,7
void drop();
void increase_data_size();
dword get_last();
bool pop();
bool delete_last();
};
 
:void collection::increase_data_size() {
82,8 → 82,8
count = 0;
}
 
:bool collection::pop() {
if (count>0) count--;
:bool collection::delete_last() {
count--;
}
 
/*========================================================
94,11 → 94,9
 
struct collection_int
{
dword buf;
dword buf_size;
unsigned count;
void alloc();
void add();
int count;
dword element[4096*3];
int add();
dword get();
dword get_last();
void pop();
105,30 → 103,20
void drop();
};
 
:void collection_int::alloc() {
if (!buf) {
buf_size = 4096;
buf = malloc(4096);
} else {
buf_size += 4096;
buf = realloc(buf, buf_size);
}
}
 
:void collection_int::add(dword _in) {
if (!buf) || (count * sizeof(dword) >= buf_size) alloc();
EAX = count * sizeof(dword) + buf;
ESDWORD[EAX] = _in;
:int collection_int::add(dword in) {
if (count >= 4096*3) return 0;
element[count] = in;
count++;
return 1;
}
 
:dword collection_int::get(dword pos) {
if (pos<0) || (pos>=count) return 0;
return ESDWORD[pos * sizeof(dword) + buf];
return element[pos];
}
 
:dword collection_int::get_last() {
return get(count-1);
return element[count];
}
 
:void collection_int::pop() {
136,7 → 124,8
}
 
:void collection_int::drop() {
element[0] = count = 0;
element[0] =
count = 0;
}
 
#endif