Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Infinity_List.h"
- #include <iostream>
- long Infinity_List::GetEntry(long index)
- {
- //TODO: FROG CODE THAT EVALUATES POINTER MORE THAN ONCE (more than one set of brackets)
- long current = this->list_ptr;
- for (long i = 0; i < index; ++i)
- {
- current = *(long*)current;
- }
- return *(long*)current;
- }
- long Infinity_List::Count() {
- return ((long*)this->list_ptr)[1];
- }
- Infinity_List::Infinity_List()
- {
- this->list_ptr = (long)malloc(sizeof(long) * 2);
- *((long*)this->list_ptr) = this->list_ptr;
- ((long*)this->list_ptr)[1] = 0;
- }
- void Infinity_List::Add(long obj_ptr)
- {
- long current = list_ptr;
- for (int i = 0; i < this->Count();++i)
- {
- current = *(long*)current;
- }
- long new_entry = (long)malloc(sizeof(long) * 2);
- ((long*)new_entry)[0] = list_ptr;
- ((long*)new_entry)[1] = obj_ptr;
- *(long*)current = new_entry;
- ++((long*)this->list_ptr)[1];
- }
- void Infinity_List::Delete()
- {
- //TODO: FROG CODE DELETE ALL AT SAME TIME (more than one set of bracket )
- long current = *(long*)list_ptr;
- for (int i = 0; i < this->Count(); ++i) {
- long old = current;
- current = *(long*)old;//deobfuscated
- free((long*)old);
- }
- free((long*)list_ptr);
- delete this;
- }
- long Infinity_List::Get(long index)
- {
- return ((long*)this->GetEntry(index))[1];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement