00001 #include <Base.h> 00002 #include <Iterator.h> 00003 00004 uint64_t AddressIterator::operator++(){ 00005 currAddress += (unitSize() - (currAddress % unitSize())); 00006 return currAddress; 00007 } 00008 uint64_t AddressIterator::operator--(){ 00009 currAddress -= (currAddress % unitSize() ? currAddress % unitSize() : unitSize()); 00010 return currAddress; 00011 } 00012 uint64_t AddressIterator::operator++(int n) { 00013 uint64_t ret = currAddress; 00014 operator++(); 00015 return ret; 00016 } 00017 uint64_t AddressIterator::operator--(int n) { 00018 uint64_t ret = currAddress; 00019 operator--(); 00020 return ret; 00021 } 00022 uint64_t AddressIterator::readBytes(char* ptr){ 00023 uint64_t ret = 0; 00024 if(unitSize() == sizeof(uint32_t)){ 00025 uint32_t buff = 0; 00026 memcpy(&buff,ptr,sizeof(uint32_t)); 00027 ret = buff; 00028 } else if(unitSize() == sizeof(uint64_t)){ 00029 memcpy(&ret,ptr,sizeof(uint64_t)); 00030 } 00031 return ret; 00032 }