i32
This commit is contained in:
@@ -14,13 +14,13 @@ void __STNode_free(void* _node){
|
||||
STNode* node=_node;
|
||||
if (!node) throw(ERR_NULLPTR);
|
||||
if(node->branches){
|
||||
for(uint8 n32 = 0;n32<8;n32++){
|
||||
for(u8 n32 = 0;n32<8;n32++){
|
||||
STNode*** ptrn32=(STNode***)node->branches[n32];
|
||||
if(ptrn32){
|
||||
for(uint8 n4 = 0;n4<8;n4++){
|
||||
for(u8 n4 = 0;n4<8;n4++){
|
||||
STNode** ptrn4=ptrn32[n4];
|
||||
if (ptrn4){
|
||||
for(uint8 rem=0;rem<4;rem++){
|
||||
for(u8 rem=0;rem<4;rem++){
|
||||
STNode* ptrrem=ptrn4[rem];
|
||||
if(ptrrem)
|
||||
STNode_free(ptrrem);
|
||||
@@ -41,9 +41,9 @@ void STNode_free(STNode* node){
|
||||
free(node);
|
||||
}
|
||||
|
||||
typedef struct {uint8 n32, n4, rem;} indexes3;
|
||||
typedef struct {u8 n32, n4, rem;} indexes3;
|
||||
|
||||
indexes3 splitindex(uint8 i){
|
||||
indexes3 splitindex(u8 i){
|
||||
return (indexes3){
|
||||
.n32=i/32,
|
||||
.n4=i%32/4,
|
||||
@@ -60,20 +60,20 @@ void ST_pushString(STNode* node_first, string key, Unitype value){
|
||||
if (!node_first) throw(ERR_NULLPTR);
|
||||
STNode* node_last=node_first;
|
||||
while(key.length--){
|
||||
indexes3 i3=splitindex((uint8)*key.ptr);
|
||||
indexes3 i3=splitindex((u8)*key.ptr);
|
||||
if(!node_last->branches){
|
||||
node_last->branches=(STNode****)malloc(8*sizeof(STNode***));
|
||||
for(uint8 i=0;i<8;i++)
|
||||
for(u8 i=0;i<8;i++)
|
||||
node_last->branches[i]=(STNode***)NULL;
|
||||
}
|
||||
if(!node_last->branches[i3.n32]){
|
||||
node_last->branches[i3.n32]=(STNode***)malloc(8*sizeof(STNode**));
|
||||
for(uint8 i=0;i<8;i++)
|
||||
for(u8 i=0;i<8;i++)
|
||||
node_last->branches[i3.n32][i]=(STNode**)NULL;
|
||||
}
|
||||
if(!node_last->branches[i3.n32][i3.n4]){
|
||||
node_last->branches[i3.n32][i3.n4]=(STNode**)malloc(4*sizeof(STNode*));
|
||||
for(uint8 i=0;i<4;i++)
|
||||
for(u8 i=0;i<4;i++)
|
||||
node_last->branches[i3.n32][i3.n4][i]=(STNode*)NULL;
|
||||
}
|
||||
if(!node_last->branches[i3.n32][i3.n4][i3.rem])
|
||||
@@ -93,7 +93,7 @@ Unitype ST_pullString(STNode* node_first, string key){
|
||||
if (!node_first) throw(ERR_NULLPTR);
|
||||
STNode* node_last=node_first;
|
||||
while (key.length--){
|
||||
indexes3 i3=splitindex((uint8)*key.ptr);
|
||||
indexes3 i3=splitindex((u8)*key.ptr);
|
||||
if(!node_last->branches) return UniNull;
|
||||
STNode*** ptrn32=(STNode***)node_last->branches[i3.n32];
|
||||
if(!ptrn32) return UniNull;
|
||||
|
||||
Reference in New Issue
Block a user