summaryrefslogtreecommitdiff
path: root/Database/internals
diff options
context:
space:
mode:
Diffstat (limited to 'Database/internals')
-rw-r--r--Database/internals/database-segment.cpp2
-rw-r--r--Database/internals/database-segment.h32
2 files changed, 33 insertions, 1 deletions
diff --git a/Database/internals/database-segment.cpp b/Database/internals/database-segment.cpp
index 8ee5b4b..6ced68f 100644
--- a/Database/internals/database-segment.cpp
+++ b/Database/internals/database-segment.cpp
@@ -9,7 +9,7 @@ Segment::Segment(Uint32 size, Uint32 id, Uint64 cpu_base, Uint32 extra_size, con
assert(size);
- if (data) {
+ if (data || !size) {
plainmemory = (Byte *) data;
loaded = true;
allocated = false;
diff --git a/Database/internals/database-segment.h b/Database/internals/database-segment.h
index dc4d157..de8e850 100644
--- a/Database/internals/database-segment.h
+++ b/Database/internals/database-segment.h
@@ -56,6 +56,38 @@ class Segment : public Base {
void LoadMemory(Handle * src);
void setTag(Uint32 ptr, memory_tags_t tag);
memory_tags_t getTag(Uint32 ptr);
+ void setBasicTag(Uint32 ptr, basic_tags_t tag) {
+ memory_tags_t t = getTag(ptr);
+ t.basic_tag = tag;
+ setTag(ptr, t);
+ }
+ basic_tags_t getBasicTag(Uint32 ptr) {
+ return (basic_tags_t) getTag(ptr).basic_tag;
+ }
+ void setCrawled(Uint32 ptr, bool crawled) {
+ memory_tags_t t = getTag(ptr);
+ t.crawled = crawled ? 1 : 0;
+ setTag(ptr, t);
+ }
+ bool getCrawled(Uint32 ptr) {
+ return getTag(ptr).crawled;
+ }
+ void setCertitude(Uint32 ptr, int certitude) {
+ if (certitude < 0)
+ certitude = -1;
+ if (certitude > 15)
+ certitude = 15;
+ memory_tags_t t = getTag(ptr);
+ t.certitude = certitude + 1;
+ }
+ int getCertitude(Uint32 ptr) {
+ return getTag(ptr).certitude - 1;
+ }
+ void ResetCrawled() {
+ for (Uint32 ptr = 0; ptr < size; ptr++) {
+ tags[ptr].crawled = 0;
+ }
+ }
Uint32 getSize() { return size; }
Uint64 getFullSize() { return size + extra_size; }
Uint64 getCpuBase() { return cpu_base; }