some small changes
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../base/base.h"
|
||||
|
||||
#define __AUTOARR2_MAX_BLOCK_LENGTH_DEFAULT 64
|
||||
#define Autoarr2_NO_REZULT (uint32)-1
|
||||
|
||||
|
||||
@@ -32,23 +35,18 @@ public:
|
||||
uint32 search(T& value, cmp_func_lambda cmpf);
|
||||
};
|
||||
|
||||
|
||||
#define __AUTOARR2_MAX_BLOCK_LENGTH_DEFAULT 64
|
||||
|
||||
template<typename T>
|
||||
Autoarr2<T>::Autoarr2() {
|
||||
values=NULL;
|
||||
block_length=0;
|
||||
blocks_count=0;
|
||||
length=0;
|
||||
max_block_length=__AUTOARR2_MAX_BLOCK_LENGTH_DEFAULT;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Autoarr2<T>::Autoarr2(uint16 _max_block_length) : Autoarr2() {
|
||||
Autoarr2<T>::Autoarr2(uint16 _max_block_length) {
|
||||
values = NULL;
|
||||
block_length = 0;
|
||||
blocks_count = 0;
|
||||
length = 0;
|
||||
max_block_length=_max_block_length;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Autoarr2<T>::Autoarr2() : Autoarr2(__AUTOARR2_MAX_BLOCK_LENGTH_DEFAULT) {}
|
||||
|
||||
template<typename T>
|
||||
Autoarr2<T>::~Autoarr2() {
|
||||
for (uint16 i=0;i<blocks_count;i++)
|
||||
|
||||
@@ -143,7 +143,8 @@ bool Hashtable2<TKey, TVal>::tryGet(TKey key, TVal* output){
|
||||
}
|
||||
|
||||
template<typename TKey, typename TVal>
|
||||
void Hashtable2<TKey, TVal>::expand(){ printf("expand\n"); fflush(stdout);
|
||||
void Hashtable2<TKey, TVal>::expand(){
|
||||
printf("expand\n"); fflush(stdout);
|
||||
if(hein>=_HT_HEIN_MAX)
|
||||
throw_id(ERR_MAXLENGTH);
|
||||
|
||||
@@ -169,7 +170,8 @@ void Hashtable2<TKey, TVal>::expand(){ printf("expand\n"); fflush(stdout);
|
||||
}
|
||||
|
||||
template<typename TKey, typename TVal>
|
||||
void Hashtable2<TKey, TVal>::add(TKey& key, TVal& value, HT_HASH_T keyHash, HT_HEIGHT_T rowN){ printf("add\n"); fflush(stdout);
|
||||
void Hashtable2<TKey, TVal>::add(TKey& key, TVal& value, HT_HASH_T keyHash, HT_HEIGHT_T rowN){
|
||||
printf("add\n"); fflush(stdout);
|
||||
Autoarr2<KeyValue>* row=rows[rowN];
|
||||
if(row->length == _HT_ARR_BC*_HT_ARR_BL)
|
||||
expand();
|
||||
|
||||
@@ -54,7 +54,6 @@ char* __unknownErr( );
|
||||
#else
|
||||
#define throw(E) __EXIT(((char*)__genErrMsg((__stringify_err(E)), __FILE__,__LINE__,__func__)))
|
||||
#define safethrow(E, FREEMEM) { FREEMEM; __RETURN_EXCEPTION(((char*)__genErrMsg((__stringify_err(E)), __FILE__,__LINE__,__func__))); }
|
||||
#endif
|
||||
|
||||
#define try(_funcCall, _rezult, freeMem) Maybe _rezult=_funcCall; if(_rezult.errmsg){\
|
||||
freeMem;\
|
||||
@@ -66,6 +65,8 @@ char* __unknownErr( );
|
||||
_rezult.errmsg=__extendErrMsg(_rezult.errmsg, __FILE__,__LINE__,__func__);\
|
||||
__EXIT(_rezult.errmsg);\
|
||||
}else
|
||||
|
||||
#endif
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user