Selaa lähdekoodia

made non negative variables unsigned

banana-cakes
FelixBrendel 6 vuotta sitten
vanhempi
commit
4bf0e5357d
1 muutettua tiedostoa jossa 7 lisäystä ja 7 poistoa
  1. +7
    -7
      bucket_allocator.hpp

+ 7
- 7
bucket_allocator.hpp Näytä tiedosto

@@ -2,9 +2,9 @@


template <typename type> template <typename type>
class Bucket_Allocator { class Bucket_Allocator {
int next_index_in_latest_bucket;
int next_bucket_index;
int bucket_count;
unsigned int next_index_in_latest_bucket;
unsigned int next_bucket_index;
unsigned int bucket_count;
unsigned int bucket_size; unsigned int bucket_size;


Array_List<type*> free_list; Array_List<type*> free_list;
@@ -45,7 +45,7 @@ public:
} }


~Bucket_Allocator() { ~Bucket_Allocator() {
for (int i = 0; i <= next_bucket_index; ++i) {
for (unsigned int i = 0; i <= next_bucket_index; ++i) {
free(buckets[i]); free(buckets[i]);
} }


@@ -56,14 +56,14 @@ public:
void for_each(proc p) { void for_each(proc p) {
free_list.sort(); free_list.sort();
type* val; type* val;
for (int i = 0; i < next_bucket_index; ++i) {
for (int j = 0; j < bucket_size; ++j) {
for (unsigned int i = 0; i < next_bucket_index; ++i) {
for (unsigned int j = 0; j < bucket_size; ++j) {
val = buckets[i]+j; val = buckets[i]+j;
if (free_list.sorted_find(val) == -1) if (free_list.sorted_find(val) == -1)
p(val); p(val);
} }
} }
for (int j = 0; j < next_index_in_latest_bucket; ++j) {
for (unsigned int j = 0; j < next_index_in_latest_bucket; ++j) {
val = buckets[next_bucket_index]+j; val = buckets[next_bucket_index]+j;
if (free_list.sorted_find(val) == -1) if (free_list.sorted_find(val) == -1)
p(val); p(val);


Ladataan…
Peruuta
Tallenna