Hello,

I'm using the following Code to do a pretty simple operation in an  
array of structs. I'm looking throug one array, that indicates that  
that array element in the array of structs is used. If that is the  
case one of the values in the corresponding line is reduced by 1 and  
checked for 0.

However this task, when compiled has my RAM-requirement jump from ~2kB  
to ~3kB, i.e. 50%. Can any of you give me a hint on how to do this  
better, i.e. more efficient??

Both table have 64 "lines" and about 11 "columns" of 8 and 16 bit  
unsigned ints.

Thanks

Tobias

Code:

task void decrease_timeouts_task() {
        uint8_t arr;
        uint8_t i;
        printf("TASK STARTED \n"); printfflush();
        for (arr = 0; arr < 8; arr++) {
                if (c_dest_occ[arr] != 0) {
                        for (i = 0; i < 8; i++) {
                                if (c_dest_occ[arr] >> i == 1) {
                                        c_dest_table[arr*8+i].t_timeout_cnt -= 
1;
                                        printf("HCTableP - decreased %X \n", 
(arr*8+i));
                                         printfflush();
                                        if (c_dest_table[arr*8+i].t_timeout_cnt 
== 0) {
                                                call 
HC_TABLE.remove_cdest(arr*8+i);
                                        }
                                }
                        }
                } else if (c_long_occ[arr] != 0) {
                        for (i = 0; i < 8; i++) {
                                if (c_long_occ[arr] >> i == 1) {
                                        c_long_table[arr*8+i].t_timeout_cnt -= 
1;
                                        if (c_long_table[arr*8+i].t_timeout_cnt 
== 0) {
                                                call 
HC_TABLE.remove_clong(arr*8+i);
                                        }
                                }
                        }
                }
        }

    }


_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to